public ActionResult Put(int id, [FromBody] SubCate scategoria) { if (id != scategoria.Id) { return(BadRequest()); } context.Entry(scategoria).State = EntityState.Modified; context.SaveChanges(); return(Ok()); }
public static SubCateModel ConvertToModel(SubCate dbSub) { SubCateModel scm = new SubCateModel(); scm.subCateID = dbSub.subCateID; scm.subCateName = dbSub.subCateName; scm.Cate.cateID = dbSub.Cate.cateID; scm.Cate.cateName = dbSub.Cate.cateName; return(scm); }
public ActionResult Post([FromBody] SubCate scategoria) { context.SubCates.Add(scategoria); context.SaveChanges(); return(new CreatedAtRouteResult("ObtenerSCategoria", new { id = scategoria.Id }, scategoria)); }