Example #1
0
        public ActionResult EditReferences(ApplicationReferenceViewModel model)
        {
            if (ModelState.IsValid)
            {
                refService.Edit(ReferencesMapper.ToEntity(model));
                return(RedirectToAction("Index", "References"));
            }

            ViewBag.ListReferences = refService.GetAll.ToList();
            return(View(model));
        }
Example #2
0
        public ActionResult EditReferences(int Id = 0)
        {
            ApplicationReferenceViewModel model = new ApplicationReferenceViewModel();

            if (Id != 0)
            {
                var entity = refService.GetById(Id);
                model = ReferencesMapper.ToViewModel(entity);
            }
            ViewBag.ListReferences = refService.GetAll
                                     .Where(x => x.IsParent && !x.IsDelete);
            return(View(model));
        }
Example #3
0
 public static ApplicationReferences ToEntity(ApplicationReferenceViewModel model)
 {
     return(new ApplicationReferences
     {
         Id = model.Id,
         Alias = model.Alias,
         Key = model.Key,
         ParentId = model.ParentId,
         Name = model.Name,
         Value = model.Value,
         IsActive = model.IsActive,
         IsDelete = model.IsDelete,
         IsParent = model.IsParent
     });
 }