i want get last record of table with particular column value. after that i need to increment value ..here table is empty and column propery is string
public async Task<string> GetLastBillNo()
{
return this.DbSet.LastOrDefault().CustomOrderNumber;
} // getting Object reference not set to an instance of an object”
bs logic is
long billNo = 0;
if (!string.IsNullOrEmpty(await invoiceRepository.GetLastBillNo()))
{
billNo = long.Parse(await invoiceRepository.GetLastBillNo());
billNo = billNo + 1;
order.CustomOrderNumber = billNo.ToString();
}
else
order.CustomOrderNumber = (billNo + 1).ToString();