예제 #1
0
        public IHttpActionResult PutTag(int id, TagDTO tagDTO)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != tagDTO.TagId)
            {
                return(BadRequest());
            }

            try
            {
                var tagDomain = AutoMapper.Mapper.Map <Tag>(tagDTO);
                //var tagBase = _tagService.ObterPorId(id);
                //tagBase.(tagDomain);
                _tagService.Alterar(tagDomain);
            }
            catch (Exception)
            {
                return(BadRequest());
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
 public ActionResult Edit([Bind(Include = "TagId,Nome,UsuarioId")] TagViewModel tagView)
 {
     if (ModelState.IsValid)
     {
         ObterIdUsuario();
         var tagDomain = AutoMapper.Mapper.Map <Tag>(tagView);
         _tagService.Alterar(tagDomain);
         return(RedirectToAction("Index"));
     }
     return(View(tagView));
 }