Пример #1
0
        public IHttpActionResult PutTags(int id, TagModel model)
        {
            try
            {
                _logger.Debug(string.Format("ini process - Put,idUser:{0}", CurrentIdUser));

                if (id != model.Id)
                {
                    _logger.Debug(string.Format("ini Put - inValid,idUser:{0}", CurrentIdUser));
                    return(BadRequest("Invalid ID"));
                }

                if (!ModelState.IsValid)
                {
                    _logger.Debug(string.Format("ini Put - inValid,idUser:{0}", CurrentIdUser));
                    return(BadRequest(ModelState));
                }

                _logger.Debug(string.Format("ini update ,idUser: {0}, modelId update: {1}", CurrentIdUser, id));

                Tag tag = AutoMapper.Mapper.Map <Tag>(model);

                tag.LastActivityIdUser = CurrentIdUser;

                _tagBL.Update(tag);

                _logger.Debug(string.Format("finish Put - success,idUser:{0}", CurrentIdUser));

                return(Ok(new JsonResponse {
                    Success = true, Message = "Tag was Saved successfully", Data = tag
                }));
            }
            catch (Exception ex)
            {
                LogError(ex);
                return(InternalServerError(ex));
            }
        }
Пример #2
0
        public async Task <IActionResult> Patch([FromRoute] string id, [FromBody] Tag viewModel)
        {
            var updated = await _tagBL.Update(id, viewModel);

            return(Accepted(updated));
        }