public ActionResult Edit(Guid id, KnowledgeAreaViewModel viewModel)
        {
            var knowledgeAreaRepository = new KnowledgeAreaRepository(_context);

            if (ModelState.IsValid)
            {
                try
                {
                    knowledgeAreaRepository.Update(KnowledgeAreaViewModel.ToEntity(viewModel));
                    _context.Save(_loggedUser);
                    TempData["MessageType"]  = "success";
                    TempData["MessageTitle"] = Resource.ContentManagementToastrTitle;
                    TempData["Message"]      = "Knowledge Area updated";
                    return(Redirect(TempData["BackURL"].ToString()));
                }
                catch (Exception ex)
                {
                    TempData["MessageType"]  = "error";
                    TempData["MessageTitle"] = Resource.ContentManagementToastrTitle;
                    TempData["Message"]      = ex.Message;
                }
            }


            return(View(viewModel));
        }
Example #2
0
        public void Modificar(KnowledgeAreaViewModel pKnowledgeAreaViewModel)
        {
            knowledge_areas oknowledge_areas = oRepositorio.FindById(pKnowledgeAreaViewModel.knowledge_area_id);

            oknowledge_areas.name = pKnowledgeAreaViewModel.name;

            oknowledge_areas.user_id_modified = pKnowledgeAreaViewModel.user_id_modified;

            oknowledge_areas.date_modified = DateTime.Now;
            oRepositorio.Update(oknowledge_areas);
            oUnitOfWork.SaveChanges();
        }