public async Task <IActionResult> Create(ProductSurface ProductSurface) { //if all poramiters which are required is ok(no nulls) if (ModelState.IsValid) { _db.Add(ProductSurface); await _db.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(ProductSurface)); }
public async Task <IActionResult> Edit(int id, ProductSurface ProductSurface) { if (id != ProductSurface.Id) { return(NotFound()); } //if all poramiters which are required is ok(no nulls) if (ModelState.IsValid) { _db.Update(ProductSurface); await _db.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(ProductSurface)); }