public ActionResult Delete(int id) { try { var UserProfile = (UserProfileSessionData)this.Session["UserProfile"]; if (UserProfile != null) { CRUDOperation CRUDOperation = new CRUDOperation(); string responseMsj = string.Empty; tbl_User userDB = CRUDOperation.DeleteUser(id, UserProfile.UserId); if (userDB != null) { TempData["success"] = "Ok"; TempData["message"] = "Məlumatlar uğurla dəyişdirildi"; return(RedirectToAction("Index")); } else { TempData["success"] = "notOk"; TempData["message"] = "Məlumatlar dəyişdirilərkən xəta baş verdi"; return(RedirectToAction("Index")); } } return(RedirectToAction("Index")); } catch (Exception ex) { return(View("Error", new HandleErrorInfo(ex, "Error", "Error"))); } }
public BaseOutput DeleteUser(Int64 id, out tbl_User itemOut) { BaseOutput baseOutput; itemOut = null; try { tbl_User user = operation.DeleteUser(id, id); itemOut = user; return(baseOutput = new BaseOutput(true, BOResultTypes.Success.GetHashCode(), BOBaseOutputResponse.SuccessResponse, "")); } catch (Exception ex) { return(baseOutput = new BaseOutput(false, BOResultTypes.Danger.GetHashCode(), BOBaseOutputResponse.DangerResponse, ex.Message)); } }
public BaseOutput DeleteProvider(Int64 providerID, out tbl_Provider itemOut) { CRUDOperation cRUDOperation = new CRUDOperation(); BaseOutput baseOutput; itemOut = null; try { tbl_Provider _propvider = cRUDOperation.GetProviderById(providerID); if (_propvider != null) { List <tbl_Proposal> _Proposals = cRUDOperation.GetProposalsByProviderID(_propvider.ID); if (_Proposals.Count > 0) { return(baseOutput = new BaseOutput(false, CustomError.ProposalRecordExistErrorCode, CustomError.ProposalRecordExistErrorDesc, "Bu provayder`a bağlı xidmətlər mövcuddur!.")); } else { tbl_User _user = cRUDOperation.DeleteUser(_propvider.UserId, _propvider.UserId); if (_user == null) { return(baseOutput = new BaseOutput(false, CustomError.NotExistRecordErrorCode, CustomError.NotExistRecordErrorDesc, "")); } tbl_Provider _ProviderDB = cRUDOperation.DeleteProvider(_propvider.ID, _user.ID); itemOut = _ProviderDB; return(baseOutput = new BaseOutput(true, BOResultTypes.Success.GetHashCode(), BOBaseOutputResponse.SuccessResponse, "")); } } return(baseOutput = new BaseOutput(true, BOResultTypes.Success.GetHashCode(), BOBaseOutputResponse.SuccessResponse, "")); } catch (Exception ex) { return(baseOutput = new BaseOutput(false, BOResultTypes.Danger.GetHashCode(), BOBaseOutputResponse.DangerResponse, ex.Message)); } }