public ActionResult Create([Bind(Include = "TagId,Nome")] TagViewModel tagView) { if (ModelState.IsValid) { var tagDomain = AutoMapper.Mapper.Map <Tag>(tagView); tagDomain.UsuarioId = User.Identity.GetUserId(); _tagService.Adicionar(tagDomain); return(RedirectToAction("Index")); } return(View(tagView)); }
public IHttpActionResult PostTag(TagDTO tagDTO) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var tagDomain = AutoMapper.Mapper.Map <Tag>(tagDTO); _tagService.Adicionar(tagDomain); return(CreatedAtRoute("DefaultApi", new { id = tagDomain.TagId }, tagDomain)); }