Ejemplo n.º 1
0
 public TagAddOrUpdateResponseDto AddOrUpdate(TagAddOrUpdateRequestDto request)
 {
     var entity = repository.GetAll()
         .Where(x => x.Id == request.Id && x.IsDeleted == false)
         .FirstOrDefault();
     if (entity == null) repository.Add(entity = new Tag());
     entity.Name = request.Name;
     entity.Description = request.Description;
     uow.SaveChanges();
     return new TagAddOrUpdateResponseDto(entity);
 }
        public TagAddOrUpdateResponseDto AddOrUpdate(TagAddOrUpdateRequestDto request)
        {
            var entity = _repository.GetAll()
                         .FirstOrDefault(x => x.Id == request.Id && x.IsDeleted == false);

            if (entity == null)
            {
                _repository.Add(entity = new Tag());
            }
            entity.Name = request.Name;
            uow.SaveChanges();
            return(new TagAddOrUpdateResponseDto(entity));
        }
Ejemplo n.º 3
0
 public IHttpActionResult Update(TagAddOrUpdateRequestDto dto)
 {
     return Ok(this.service.AddOrUpdate(dto));
 }