Example #1
0
        public DivisionAddOrUpdateResponseDto AddOrUpdate(DivisionAddOrUpdateRequestDto request)
        {
            var entity = _repository.GetAll()
                         .FirstOrDefault(x => x.Id == request.Id && x.IsDeleted == false);

            if (entity == null)
            {
                _repository.Add(entity = new Division());
            }
            entity.Name = request.Name;
            _uow.SaveChanges();
            return(new DivisionAddOrUpdateResponseDto(entity));
        }
Example #2
0
 public IHttpActionResult Update(DivisionAddOrUpdateRequestDto dto)
 {
     return(Ok(_divisionService.AddOrUpdate(dto)));
 }