public ActionResult CreateSphere(MvcSphere sphere) { if (ModelState.IsValid) { spheres.Create(SphereMapper.GetBLLEntity(sphere)); return(RedirectToRoute("Spheres")); } return(View()); }
public static BLLSphere GetBLLEntity(MvcSphere sphere) { return(new BLLSphere() { Id = sphere.Id, Name = sphere.Name, Level = sphere.Level, CategoryName = sphere.CategoryName }); }
public ActionResult EditSphere(int id) { MvcSphere sphere = SphereMapper.GetMVCEntity(spheres.Get(id)); IEnumerable <BLLCategory> allCategories = categories.GetAll(); List <string> mvcCategories = allCategories.Select(c => c.Name).ToList(); ViewBag.Categories = mvcCategories; return(View(sphere)); }