public IActionResult DeleteCustomerType(int customerTypeId) { if (!_customerTypeService.IsCustomerTypeExist(customerTypeId)) { return(NotFound()); } var customerType = _customerTypeService.GetCustomerTypeById(customerTypeId); _customerTypeService.DeleteCustomerType(customerType); return(NoContent()); }
public IActionResult Delete(int id) { CustomerType = new CustomerType(); CustomerType = _CustomerTypeService.FindCustomerType(id); if (CustomerType == null) { // return Json(new { success = false, message = "Error while Deleting" }); return(RedirectToAction("ListCustomerType")); } else { _CustomerTypeService.DeleteCustomerType(CustomerType); return(RedirectToAction("ListCustomerType")); // return Json(new { success = true, message = "Delete Successful" }); } }