public IHttpActionResult Get(int id) { DTO_CAT_LinhVuc tbl_CAT_LinhVuc = BS_CAT_LinhVuc.get_CAT_LinhVuc(db, id); if (tbl_CAT_LinhVuc == null) { return(NotFound()); } return(Ok(tbl_CAT_LinhVuc)); }
public IHttpActionResult Post(DTO_CAT_LinhVuc tbl_CAT_LinhVuc) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } DTO_CAT_LinhVuc result = BS_CAT_LinhVuc.post_CAT_LinhVucCustom(db, tbl_CAT_LinhVuc, Username); if (result != null) { return(CreatedAtRoute("get_CAT_LinhVuc", new { id = result.ID }, result)); } return(Conflict()); }
public IHttpActionResult Delete(int id) { bool check = BS_CAT_LinhVuc.check_CAT_LinhVuc_Exists(db, id); if (!check) { return(NotFound()); } bool result = BS_CAT_LinhVuc.delete_CAT_LinhVuc(db, id, Username); if (result) { return(StatusCode(HttpStatusCode.NoContent)); } return(Conflict()); }
public IHttpActionResult Put(int id, DTO_CAT_LinhVuc tbl_CAT_LinhVuc) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != tbl_CAT_LinhVuc.ID) { return(BadRequest()); } bool result = BS_CAT_LinhVuc.put_CAT_LinhVucCustom(db, id, tbl_CAT_LinhVuc, Username); if (result) { return(StatusCode(HttpStatusCode.NoContent)); } else { return(NotFound()); } }
public IQueryable <DTO_CAT_LinhVuc> Get() { return(BS_CAT_LinhVuc.get_CAT_LinhVucCustom(db, QueryStrings)); }