public ActionResult Delete(PlanVm plan) { if (plan.Id > 0) { bool response = _planService.DeletePlan(plan); if (response) { _pageMessageSvc.SetSuccessMessage(string.Format("Plan [{0}] was deleted successfully.", plan.Name.ToUpper())); } else { _pageMessageSvc.SetErrormessage(string.Format("There was an error deleting plan [{0}] ", plan.Name.ToUpper())); } } return(_uniquePageService.RedirectTo <PlanPage>()); }
public async Task <ActionResult <bool> > DeletePlan(int id) { try { var PlanForDelete = await _planService.GetPlan(id); if (PlanForDelete == null) { return(NotFound()); } return(await _planService.DeletePlan(id)); } catch (Exception ex) { _logger.LogError(SR.ErrorRetrievingDataFromDataBase, ex); return(StatusCode(StatusCodes.Status500InternalServerError, SR.ErrorRetrievingDataFromDataBase)); } }
public ActionResult Remove(int id) { try { var result = _planService.DeletePlan(id); if (!result) { return(StatusCode(StatusCodes.Status404NotFound)); } return(NoContent()); } catch (Exception e) { return(StatusCode(StatusCodes.Status500InternalServerError, e.Message)); } }
public ActionResult Delete(int id, string deleteType) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageHyip)) { return(AccessDeniedView()); } var plan = _planService.GetPlanById(id); if (plan == null) { return(RedirectToAction("List")); } _planService.DeletePlan(plan); _customerActivityService.InsertActivity("DeletePlan", _localizationService.GetResource("ActivityLog.DeletePlan"), plan.Name); NotifySuccess(_localizationService.GetResource("Admin.Hyip.Plans.Deleted")); return(RedirectToAction("List")); }
/// <summary> /// Удаление плана. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Btn_DeletePlan_Click(object sender, EventArgs e) { try { if (dgvPlans.SelectedRows.Count != 1) { MessageBox.Show("Выберите план для удаления", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } var planId = int.Parse(dgvPlans.SelectedRows[0].Cells["PlanId"].Value?.ToString()); var confirmation = MessageBox.Show("Удалить план?", "Подтверждение", MessageBoxButtons.OKCancel, MessageBoxIcon.Error); if (confirmation == DialogResult.OK) { _planService.DeletePlan(planId); RefreshPlansList(); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <summary> /// Deletes plen with specified id /// </summary> /// <param name="planId">Unique id of deleted plan</param> public void DeletePlan(Guid planId) { _planService.DeletePlan(planId); }