Esempio n. 1
0
        public bool Update(UpdateAreaDTO areaDTO)
        {
            if (areaDTO == null)
            {
                throw new ArgumentNullException();
            }

            bool result = false;

            areaDTO.ByAdmin = true;
            Area area = Mapper.Map <Area>(areaDTO);

            TheUnitOfWork.AreaRepo.Update(area);
            result = TheUnitOfWork.SaveChanges() > new int();
            return(result);
        }
Esempio n. 2
0
 public ActionResult Put(int id, UpdateAreaDTO areaDTO)
 {
     if (ModelState.IsValid == false)
     {
         return(BadRequest(ModelState));
     }
     if (id != areaDTO.ID)
     {
         return(BadRequest());
     }
     try
     {
         _areaAppServices.Update(areaDTO);
         _generalAppService.CommitTransaction();
         return(Ok());
     }
     catch (Exception ex)
     {
         _generalAppService.RollbackTransaction();
         return(BadRequest(ex.Message));
     }
 }