Пример #1
0
        public async Task <IHttpActionResult> PostSupplier(Supplier supplier)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            try
            {
                await _SVC.AddSupplier(supplier);
            }
            catch (DbUpdateException)
            {
                if (SupplierExists(supplier.ID))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = supplier.ID }, supplier));
        }
Пример #2
0
 async public Task <ActionResult> Add(Supplier item)
 {
     return(Content(await _Server.AddSupplier(item)));
 }