I am getting this error one of my projects.
InvalidOperationException: Sequence contains no elements.
here is my code in this I am trying to create auto-generated Id with string format.
public async Task<IActionResult> Create()
{
int id = _db.Patient.Max(item => item.Id)+1;
ViewBag.autoid = "BL0000"+id.ToString();
return View();
}
