public IHttpActionResult Get(int id)
        {
            var item = Repositories.GetCateRoomByID(id);
            var cr   = new CategoryRoomView {
                IDCateRoom = item.IDCateRoom, NameCateRoom = item.NameCateRoom, PriceCateRoom = item.PriceCateRoom
            };

            return(Ok(cr));
        }
        public ActionResult UpdateCateRoom(CategoryRoomView cr)
        {
            var res = GlobalVariables.client.PutAsJsonAsync("CategoryRoom/" + cr.IDCateRoom.ToString(), cr).Result;

            if (res.IsSuccessStatusCode)
            {
                TempData["success"] = "Update category successfully!";
                return(RedirectToAction("Index"));
            }
            TempData["error"] = "Update new category failed!";
            return(RedirectToAction("GetCateRoom", new { id = cr.IDCateRoom }));
        }
        public ActionResult CreateCateRoom(CategoryRoomView cr)
        {
            HttpResponseMessage res = GlobalVariables.client.PostAsJsonAsync("CategoryRoom", cr).Result;

            if (res.IsSuccessStatusCode)
            {
                TempData["success"] = "Create new category successfully!";
                return(RedirectToAction("Index"));
            }
            TempData["error"] = "Create new category failed!";
            return(RedirectToAction("CreateCateRoom"));
        }
        // PUT api/<controller>/5
        public IHttpActionResult Put(int id, CategoryRoomView cr)
        {
            var item = new CategoryRoom {
                IDCateRoom = cr.IDCateRoom, NameCateRoom = cr.NameCateRoom, PriceCateRoom = cr.PriceCateRoom
            };

            if (Repositories.UpdateCateRoom(item) == true)
            {
                return(Ok());
            }
            return(InternalServerError());
        }
        // POST api/<controller>
        public IHttpActionResult Post(CategoryRoomView cr)
        {
            var newItem = new CategoryRoom {
                NameCateRoom = cr.NameCateRoom, PriceCateRoom = cr.PriceCateRoom
            };

            if (Repositories.CreateCateRoom(newItem) == true)
            {
                return(Ok());
            }
            return(InternalServerError());
        }