我解决了这个问题
public async Task<IActionResult> Create()
{
//x = _db.Patient.Max(item => item.Id);
x=_db.Patient.DefaultIfEmpty().Max(item => item == null ? 1 : item.Id+1);
ViewBag.autoid = "BL0000"+x.ToString();
return View();
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句