Пример #1
0
 public bool Edit(TypeProgramDTO typeProgram)
 {
     try
     {
         var data = MapperProfile.MapperConfig().Map <TypeProgram>(typeProgram);
         _unitOfWork.TypeProgramRepository.Edit(data);
         return(_unitOfWork.Commit());
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
         return(false);
     }
 }
        public ActionResult Edit(TypeProgramDTO typeProgram)
        {
            if (!ModelState.IsValid)
            {
                return(View());
            }

            if (new TypeProgramDao(_unitOfWork).CheckHaveExist(typeProgram.TypeName))
            {
                TempData[MessageConst.ERROR] = "This name have exist!";
                return(View());
            }

            if (new TypeProgramDao(_unitOfWork).Edit(typeProgram))
            {
                return(RedirectToAction("Index"));
            }

            return(View());
        }