示例#1
0
 public HttpStatusCode Insert(Company comp)
 {
     if (ModelState.IsValid)
     {
         Adapter.CompanyRepository.Insert(comp);
         Adapter.Save();
         return HttpStatusCode.Created;
     }
     throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.BadRequest));
 }
示例#2
0
 public HttpStatusCode Update(int id, Company comp)
 {
     if (ModelState.IsValid && id == comp.CompanyId)
     {
         comp.ModifiedDate = DateTime.Now;
         Adapter.CompanyRepository.Update(comp);
         Adapter.Save();
         return HttpStatusCode.OK;
     }
     throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.BadRequest));
 }