public async Task <IActionResult> Edit(Size size) { if (size.Name == null) { ModelState.AddModelError("", "Name is required"); return(View(size)); } db.Entry(size).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); }