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

            if (entity == null)
            {
                _repository.Add(entity = new Search());
            }
            entity.Name = request.Name;
            _uow.SaveChanges();
            return(new SearchAddOrUpdateResponseDto(entity));
        }
Example #2
0
 public IHttpActionResult Update(SearchAddOrUpdateRequestDto dto)
 {
     return(Ok(_service.AddOrUpdate(dto)));
 }