Esempio n. 1
0
        public IHttpActionResult Get(int id)
        {
            DTO_CAT_KinhPhi tbl_CAT_KinhPhi = BS_CAT_KinhPhi.get_CAT_KinhPhi(db, id);

            if (tbl_CAT_KinhPhi == null)
            {
                return(NotFound());
            }

            return(Ok(tbl_CAT_KinhPhi));
        }
Esempio n. 2
0
        public IHttpActionResult Post(DTO_CAT_KinhPhi tbl_CAT_KinhPhi)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            DTO_CAT_KinhPhi result = BS_CAT_KinhPhi.post_CAT_KinhPhi(db, tbl_CAT_KinhPhi, Username);


            if (result != null)
            {
                return(CreatedAtRoute("get_CAT_KinhPhi", new { id = result.ID }, result));
            }
            return(Conflict());
        }
Esempio n. 3
0
        public IHttpActionResult Delete(int id)
        {
            bool check = BS_CAT_KinhPhi.check_CAT_KinhPhi_Exists(db, id);

            if (!check)
            {
                return(NotFound());
            }

            bool result = BS_CAT_KinhPhi.delete_CAT_KinhPhi(db, id, Username);

            if (result)
            {
                return(StatusCode(HttpStatusCode.NoContent));
            }
            return(Conflict());
        }
Esempio n. 4
0
        public IHttpActionResult Put(int id, DTO_CAT_KinhPhi tbl_CAT_KinhPhi)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != tbl_CAT_KinhPhi.ID)
            {
                return(BadRequest());
            }

            bool result = BS_CAT_KinhPhi.put_CAT_KinhPhi(db, id, tbl_CAT_KinhPhi, Username);

            if (result)
            {
                return(StatusCode(HttpStatusCode.NoContent));
            }
            else
            {
                return(NotFound());
            }
        }
Esempio n. 5
0
 public IQueryable <DTO_CAT_KinhPhi> Get()
 {
     return(BS_CAT_KinhPhi.get_CAT_KinhPhi(db, QueryStrings));
 }