public ActionResult Create(Create model) { if (ModelState.IsValid) { Viewclient viewclient = new Viewclient() { Name = model.Name }; viewclientService.InsertViewclient(viewclient); return RedirectToAction("Edit", new { id = viewclient.ViewclientID }); } ViewBag.StatusMsg = "Ok"; return View(model); }
public void InsertViewclient(Viewclient viewclient) { dbContext.Viewclients.Add(viewclient); dbContext.SaveChanges(); }
public void UpdateViewclient(int id, Viewclient updated_viewclient) { Viewclient viewclient_to_update = dbContext.Viewclients.Find(id); viewclient_to_update.Name = updated_viewclient.Name; dbContext.Entry(viewclient_to_update).State = System.Data.Entity.EntityState.Modified; dbContext.SaveChanges(); }