Example #1
0
        // GET: api/[email protected]&id=1217
        public DanhGia Get(int IdUser, int id)
        {
            if (Test() == false)
            {
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.NotFound));
            }
            DanhGiaDAO dgO = new DanhGiaDAO();

            DanhGia[] dg = new DanhGia[dgO.getDanhGia(IdUser, id).Count];
            dg = dgO.getDanhGia(IdUser, id).ToArray();
            //if (dg.Length == 0)
            //    throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.NotFound));
            return(dg[0]);
        }
Example #2
0
        // DELETE: api/[email protected]&id=1217
        public bool Delete(int IdUser, int id)
        {
            if (Test() == false)
            {
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.NotFound));
            }
            DanhGiaDAO dgO = new DanhGiaDAO();

            DanhGia[] dg = new DanhGia[dgO.getDanhGia(IdUser, id).Count];
            dg = dgO.getDanhGia(IdUser, id).ToArray();
            if (dg.Length == 0)
            {
                return(false);
            }
            dgO.deleteDanhGia(IdUser, id);
            return(true);
        }
Example #3
0
        // GET: api/DanhGia/5
        //public IEnumerable<DanhGia> Get(int id)
        //{
        //    DanhGiaDAO dgO = new DanhGiaDAO();

        //    DanhGia[] dg = new DanhGia[dgO.getDsDanhGia(id).Count];
        //    dg = dgO.getDsDanhGia(id).ToArray();
        //    //if (dg.Length == 0)
        //    //    throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.NotFound));

        //    return dg;

        //}

        public float Get(int madiadiem)
        {
            if (Test() == false)
            {
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.NotFound));
            }
            DanhGiaDAO dgO = new DanhGiaDAO();

            return(dgO.getDanhGia(madiadiem));
            //if (dg.Length == 0)
            //    throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.NotFound));
        }