// GET: /Category/Details/5 public ActionResult Details(int?Id) { try { MVC_DomainEntities.Category category = ICategoryService.GetCategory(Id); Mapper.CreateMap <MVC_DomainEntities.Category, CategoryModel>(); CategoryModel model = Mapper.Map <CategoryModel>(category); return(View(model)); } catch (Exception ex) { ILoggerService.AddLogger("CategoryController-Details", ex.ToString()); return(View()); } }
public ActionResult Edit([Bind(Include = "CategoryId,Name")] CategoryModel model) { try { if (ModelState.IsValid) { Mapper.CreateMap <CategoryModel, MVC_DomainEntities.Category>(); MVC_DomainEntities.Category category = Mapper.Map <MVC_DomainEntities.Category>(model); ICategoryService.EditCategory(category); return(RedirectToAction("Index")); } } catch (Exception ex) { ILoggerService.AddLogger("CategoryController-Edit", ex.ToString()); } return(View(model)); }