public ActionResult <Customer> Delete(int id) { try { return(Ok(_cs.Delete(id))); } catch (System.Exception err) { return(BadRequest(err.Message)); } }
public async Task <bool> Delete <T>(T entity) { switch (entity) { case CustomerDto x: return(await CustomersService.Delete(x)); case SupplierDto x: return(await SuppliersService.Delete(x)); case ShipperDto x: return(await ShippersService.Delete(x)); default: return(false); } }
public ActionResult Delete(int customerId) { try { customerService.Delete(customerId); var responseModel = new ResponseModel { StatusCode = (int)HttpStatusCode.OK, MessageAr = AppResource.DeletedSuccessfully }; return(Json(responseModel, JsonRequestBehavior.AllowGet)); } catch (System.Exception) { var responseModel = new ResponseModel { StatusCode = (int)HttpStatusCode.OK, MessageAr = AppResource.DeleteErrorValidation }; return(Json(responseModel, JsonRequestBehavior.AllowGet)); } }