Пример #1
0
 public void SubmitForm(TagsEntity tagsEntity, string keyValue)
 {
     if (!string.IsNullOrEmpty(keyValue))
     {
         tagsEntity.Modify(keyValue);
         service.Update(tagsEntity);
     }
     else
     {
         tagsEntity.Create();
         service.Insert(tagsEntity);
     }
 }
Пример #2
0
        public async Task <TagsResponse> UpdateAsync(int id, Tags tags)
        {
            var existingTags = await _tagsRepository.FindByIdAsync(id);

            if (existingTags == null)
            {
                return(new TagsResponse("tags not found."));
            }

            existingTags.Name = tags.Name;

            try
            {
                _tagsRepository.Update(existingTags);
                await _unitOfWork.CompleteAsync();

                return(new TagsResponse(existingTags));
            }
            catch (Exception ex)
            {
                // Do some logging stuff
                return(new TagsResponse($"An error occurred when updating the tags: {ex.Message}"));
            }
        }
Пример #3
0
 public async Task <bool> Update(Tags tag)
 {
     return(await _tagsRepository.Update(tag));
 }
Пример #4
0
        public TagModel UpdateTag(TagModel model)
        {
            var updated = _repo.Update(model);

            return(GetTag(updated.Id));
        }
Пример #5
0
        public void Update(TagsViewModel obj)
        {
            var tag = _mapper.Map <Tags>(obj);

            _tagsRepository.Update(tag);
        }