public ActionResult Create(FormCollection collection) { if (ModelState.IsValid) { officer o = new officer(); o.name = collection["name"]; //oc.officers.Add(o); //oc.SaveChanges(); // or.Add(o); _offser.CreateOfficer(o); return RedirectToAction("Index"); } else { return View(oc.officers.ToList()); } }
public void CreateOfficer(officer off) { _IRepository.Add(off); }