Пример #1
0
        public ArchitectureItemAddOrUpdateResponseDto AddOrUpdate(ArchitectureItemAddOrUpdateRequestDto request)
        {
            var entity = _repository.GetAll()
                         .FirstOrDefault(x => x.Id == request.Id && x.IsDeleted == false);

            if (entity == null)
            {
                _repository.Add(entity = new ArchitectureItem());
            }
            entity.Name = request.Name;
            _uow.SaveChanges();
            return(new ArchitectureItemAddOrUpdateResponseDto(entity));
        }
 public IHttpActionResult Update(ArchitectureItemAddOrUpdateRequestDto dto)
 {
     return(Ok(_architectureItemService.AddOrUpdate(dto)));
 }