// GET: Imparirment/Delete/5 public ActionResult Delete(int id) { ViewBag.LastNameUser = lastName; var model = Mapper.Map <Impairment, ImpairmentViewModel>(ImpairmentManager.GetById(id)); return(View(model)); }
public ActionResult Delete(int id, ImpairmentViewModel model) { try { ImpairmentManager.DeleteImpairment(id); return(RedirectToAction("Index")); } catch { return(View(model)); } }
public ActionResult Edit(int id, ImpairmentViewModel model) { try { var impairment = Mapper.Map <ImpairmentViewModel, Impairment>(model); ImpairmentManager.StoreImpairment(impairment); return(RedirectToAction("Index")); } catch { return(View(model)); } }
public ActionResult Create(ImpairmentViewModel model) { ViewBag.LastNameUser = lastName; try { var impairment = Mapper.Map <ImpairmentViewModel, Impairment>(model); ImpairmentManager.StoreImpairment(impairment); return(RedirectToAction("Index")); } catch { return(View()); } }
// GET: Imparirment/Details/5 public ActionResult Details(int id) { var modelCount = Mapper.Map <Impairment, ImpairmentViewModel>(ImpairmentManager.GetById(id)); modelCount.VisitCount++; var impairment = Mapper.Map <ImpairmentViewModel, Impairment>(modelCount); ImpairmentManager.StoreImpairment(impairment); var model = Mapper.Map <ImpairmentViewModel>(ImpairmentManager.GetById(id)); var deficiencis = Mapper.Map <IList <Deficiency>, IList <DeficiencyViewModel> >(deficiencyManager.GetAllDeficiencys()).ToList(); if (id == (int)Impairments.Adquiridas) { var ownList = deficiencis.ToList().Where(c => c.Kind.CompareTo(Impairments.Adquiridas.ToString()) == 0); ViewBag.ownData = ownList; } else if (id == (int)Impairments.Audiovisuales) { var ownList = deficiencis.ToList().Where(c => c.Kind.CompareTo(Impairments.Audiovisuales.ToString()) == 0); ViewBag.ownData = ownList; } else if (id == (int)Impairments.Cognitivas) { var ownList = deficiencis.ToList().Where(c => c.Kind.CompareTo(Impairments.Cognitivas.ToString()) == 0); ViewBag.ownData = ownList; } else if (id == (int)Impairments.Congénitas) { var ownList = deficiencis.ToList().Where(c => c.Kind.CompareTo(Impairments.Congénitas.ToString()) == 0); ViewBag.ownData = ownList; } else if (id == (int)Impairments.Fisicomotoras) { var ownList = deficiencis.ToList().Where(c => c.Kind.CompareTo(Impairments.Fisicomotoras.ToString()) == 0); ViewBag.ownData = ownList; } else if (id == (int)Impairments.Hereditarias) { var ownList = deficiencis.ToList().Where(c => c.Kind.CompareTo(Impairments.Hereditarias.ToString()) == 0); ViewBag.ownData = ownList; } return(View(model)); }
// GET: Imparirment/Delete/5 public ActionResult Delete(int id) { var model = Mapper.Map <Impairment, ImpairmentViewModel>(ImpairmentManager.GetById(id)); return(View(model)); }
// GET: Imparirment public ActionResult Index() { var imparirments = Mapper.Map <IList <Impairment>, IList <ImpairmentViewModel> >(ImpairmentManager.GetAllImpairments()).ToList(); return(View(imparirments)); }
// GET: Imparirment public ActionResult Index() { //aqui se puede mostrar el total de visitas de todos los impairments ViewBag.LastNameUser = lastName; var imparirments = Mapper.Map <IList <Impairment>, IList <ImpairmentViewModel> >(ImpairmentManager.GetAllImpairments()).ToList(); ViewBag.TotalImpairment = imparirments.Sum(item => item.VisitCount); return(View(imparirments)); }