public ActionResult Create(Congregation model) { if (ModelState.IsValid) { dataContext.Create<Congregation>(model); Success("Your information was saved!"); return RedirectToAction("Index"); } Error("there were some errors in your form."); return View(model); }
public ActionResult Edit(Congregation model, int id) { if(ModelState.IsValid) { //_models.Remove(_models.Get(id)); //model.Id = id; //_models.Add(model); var oldModel = dataContext.ExecuteStoredProcedure<Congregation>("api_Example_GetSingleCongregation", new { CongregationID = id }).SingleOrDefault(); dataContext.Update<Congregation>(oldModel, model); Success("The model was updated!"); return RedirectToAction("index"); } return View("Create", model); }