コード例 #1
0
 public IHttpActionResult UpdateSupplier(SupplierModel model)
 {
     var entity = new Supplier
     {
         Address = model.Address,
         City = model.City,
         CompanyName = model.CompanyName,
         ContactName = model.ContactName,
         ContactTitle = model.ContactTitle,
         Country = model.Country,
         Fax = model.Fax,
         HomePage = model.HomePage,
         Phone = model.Phone,
         PostalCode = model.PostalCode,
         Region = model.Region
     };
     _repository.UpdateSupplier(entity);
     return Ok<SupplierModel>(model);
 }
コード例 #2
0
 public IHttpActionResult CreateSupplier(SupplierModel newSupplier)
 {
     var entity = new Supplier{
         Address = newSupplier.Address,
         City = newSupplier.City,
         CompanyName = newSupplier.CompanyName,
         ContactName = newSupplier.ContactName,
         ContactTitle = newSupplier.ContactTitle,
         Country = newSupplier.Country,
         Fax = newSupplier.Fax,
         HomePage = newSupplier.HomePage,
         Phone = newSupplier.Phone,
         PostalCode = newSupplier.PostalCode,
     };
     entity = _repository.CreateSupplier(entity);
     newSupplier.SupplierID = entity.SupplierID;
     String loc = Url.Link("api/suppliers/{supplierID}", new { supplierID = entity.SupplierID});
     return Created<SupplierModel>(loc, newSupplier);
 }