コード例 #1
0
        public SectionAddOrUpdateResponseDto AddOrUpdate(SectionAddOrUpdateRequestDto request)
        {
            var entity = _repository.GetAll()
                         .FirstOrDefault(x => x.Id == request.Id && x.IsDeleted == false);

            if (entity == null)
            {
                _repository.Add(entity = new Section());
            }
            entity.Name = request.Name;
            _uow.SaveChanges();
            return(new SectionAddOrUpdateResponseDto(entity));
        }
コード例 #2
0
 public IHttpActionResult Update(SectionAddOrUpdateRequestDto dto)
 {
     return(Ok(_sectionService.AddOrUpdate(dto)));
 }