public JsonResult Delete(int id, FormCollection collection) { ResponseMessage responseMessage = null; try { _service.Delete(id); responseMessage = new ResponseMessage(MessageType.Success) { Status = true, Message = "Record successfully deleted.", Title = "Delete record.", }; } catch (Exception e) { responseMessage = new ResponseMessage(MessageType.Failure) { Status = false, Message = e.Message, Title = "Error Deleting record." }; } return(Json(responseMessage)); }
public JsonResult Delete(AccountTypeModel model) { try { #region " [ Declaration ] " AccountTypeService _service = new AccountTypeService(); #endregion #region " [ Main process ] " model.CreateBy = UserID; model.DeleteBy = UserID; model.DeleteDate = DateTime.Now; #endregion //Call to service return(this.Json(_service.Delete(model), JsonRequestBehavior.AllowGet)); } catch (ServiceException serviceEx) { throw serviceEx; } catch (DataAccessException accessEx) { throw accessEx; } catch (Exception ex) { throw new ControllerException(FILE_NAME, MethodInfo.GetCurrentMethod().Name, UserID, ex); } }
// DELETE: api/AccountType/5 public IHttpActionResult Delete(int id) { if (id <= 0) { return(BadRequest("Not a valid id")); } _service.Delete(id); return(Ok()); }
public void Delete(int id) { var item = this.AccountTypeService.GetById(id); if (item != null) { if (AccountService.Query(new AccountRequest() { AccountTypeId = item.AccountTypeId }).Count() > 0) { AddError("delete.existAccount"); } else { AccountTypeService.Delete(item); Logger.LogWithSerialNo(LogTypes.AccountTypeDelete, SerialNoHelper.Create(), item.AccountTypeId, item.DisplayName); AddMessage("delete.success", item.DisplayName); } CacheService.Refresh(CacheKeys.PointPolicyKey); } }