Exemplo n.º 1
0
        public AppAddOrUpdateResponseDto AddOrUpdate(AppAddOrUpdateRequestDto request)
        {
            var entity = _repository.GetAll()
                         .FirstOrDefault(x => x.Id == request.Id && x.IsDeleted == false);

            if (entity == null)
            {
                _repository.Add(entity = new App());
            }
            entity.Name = request.Name;
            _uow.SaveChanges();
            return(new AppAddOrUpdateResponseDto(entity));
        }
 public IHttpActionResult Update(AppAddOrUpdateRequestDto dto)
 {
     return(Ok(_appService.AddOrUpdate(dto)));
 }