示例#1
0
        // PUT api/<controller>/5
        public IHttpActionResult Put(CompanyCategory companyCategory)
        {
            IHttpActionResult      result  = null;
            CompanyCategoryService service = new CompanyCategoryService();

            if (service.GetCompanyCategory(companyCategory.ID) != null)
            {
                service.UpdateCompanyCategory(companyCategory);
                result = Ok(companyCategory);
            }
            else
            {
                result = NotFound();
            }

            return(result);
        }
示例#2
0
        // GET api/<controller>/5
        public IHttpActionResult Get(int id)
        {
            IHttpActionResult result = null;

            CompanyCategoryService service = new CompanyCategoryService();

            CompanyCategory companyCategory = service.GetCompanyCategory(id);

            if (companyCategory != null)
            {
                result = Ok(companyCategory);
            }
            else
            {
                result = NotFound();
            }

            return(result);
        }
示例#3
0
        // DELETE api/<controller>/5
        public IHttpActionResult Delete(int id)
        {
            IHttpActionResult      result  = null;
            CompanyCategoryService service = new CompanyCategoryService();

            CompanyCategory companyCategory = service.GetCompanyCategory(id);

            if (companyCategory != null)
            {
                service.RemoveCompanyCategory(id);

                result = Ok(true);
            }
            else
            {
                result = NotFound();
            }

            return(result);
        }