示例#1
0
        public IHttpActionResult Get(int id)
        {
            DTO_PRO_SYLL tbl_PRO_SYLL = BS_PRO_SYLL.get_PRO_SYLL(db, id);

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

            return(Ok(tbl_PRO_SYLL));
        }
示例#2
0
        public IHttpActionResult Save(DTO_PRO_SYLL tbl_PRO_SYLL)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            DTO_PRO_SYLL result = BS_PRO_SYLL.save_PRO_SYLL(db, tbl_PRO_SYLL, Username);

            if (result != null)
            {
                return(Ok(result));
            }
            return(BadRequest());
        }
示例#3
0
        public IHttpActionResult Post(DTO_PRO_SYLL tbl_PRO_SYLL)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            DTO_PRO_SYLL result = BS_PRO_SYLL.post_PRO_SYLL(db, tbl_PRO_SYLL, Username);


            if (result != null)
            {
                return(CreatedAtRoute("get_PRO_SYLL", new { id = result.ID }, result));
            }
            return(Conflict());
        }
示例#4
0
        public IHttpActionResult Delete(int id)
        {
            bool check = BS_PRO_SYLL.check_PRO_SYLL_Exists(db, id);

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

            bool result = BS_PRO_SYLL.delete_PRO_SYLL(db, id, Username);

            if (result)
            {
                return(StatusCode(HttpStatusCode.NoContent));
            }
            return(Conflict());
        }
示例#5
0
        public IHttpActionResult GetCustom(int idDeTai, int idNhanSu, bool isChuNhiem, bool?isInput = false)
        {
            DTO_PRO_SYLL tbl_PRO_SYLL = BS_PRO_SYLL.get_PRO_SYLLCustom(db, idDeTai, idNhanSu);
            //if (tbl_PRO_LLKH.ID == 0)
            //{
            string html      = "";
            string htmlPrint = "";

            if (isChuNhiem)
            {
                using (System.IO.StreamReader r = new System.IO.StreamReader(System.Web.Hosting.HostingEnvironment.MapPath("~/Content/FormTemplate/NhanSuSYLL_ChuNhiemDeTai.html")))
                {
                    htmlPrint = r.ReadToEnd();
                }
            }
            else
            {
                using (System.IO.StreamReader r = new System.IO.StreamReader(System.Web.Hosting.HostingEnvironment.MapPath("~/Content/FormTemplate/NhanSuSYLL.html")))
                {
                    htmlPrint = r.ReadToEnd();
                }
            }

            if (isChuNhiem)
            {
                using (System.IO.StreamReader r = new System.IO.StreamReader(System.Web.Hosting.HostingEnvironment.MapPath("~/Content/FormTemplate/NhanSuSYLL_ChuNhiemDeTai_Input.html")))
                {
                    html = r.ReadToEnd();
                }
            }
            else
            {
                using (System.IO.StreamReader r = new System.IO.StreamReader(System.Web.Hosting.HostingEnvironment.MapPath("~/Content/FormTemplate/NhanSuSYLL_Input.html")))
                {
                    html = r.ReadToEnd();
                }
            }

            tbl_PRO_SYLL.HTML      = html;
            tbl_PRO_SYLL.HTMLPrint = htmlPrint;
            //}

            return(Ok(tbl_PRO_SYLL));
        }
示例#6
0
        public IHttpActionResult Put(int id, DTO_PRO_SYLL tbl_PRO_SYLL)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

            bool result = BS_PRO_SYLL.put_PRO_SYLL(db, id, tbl_PRO_SYLL, Username);

            if (result)
            {
                return(StatusCode(HttpStatusCode.NoContent));
            }
            else
            {
                return(NotFound());
            }
        }
示例#7
0
 public IQueryable <DTO_PRO_SYLL> Get()
 {
     return(BS_PRO_SYLL.get_PRO_SYLL(db, QueryStrings));
 }