Пример #1
0
        public HttpResponseMessage Delete([FromBody] EquipCategoryDTO equipCategoryDTO)
        {
            EquipCategoryService.Delete(equipCategoryDTO);
            string tmp = string.Format($"{ equipCategoryDTO.EquipCategoryID } has been deleted");
            HttpResponseMessage msg = Request.CreateResponse(HttpStatusCode.OK, tmp);
            string url = Url.Link("DefaultApi", new { id = equipCategoryDTO.EquipCategoryID });

            msg.Headers.Location = new Uri(url);
            return(msg);
        }
Пример #2
0
        public HttpResponseMessage Get(int id)
        {
            EquipCategoryDTO equipCategoryDTO = EquipCategoryService.Get(id);

            if (equipCategoryDTO == null)
            {
                return(Request.CreateResponse(HttpStatusCode.NotFound, "NotFound"));
            }
            return(Request.CreateResponse(HttpStatusCode.OK, equipCategoryDTO));
        }