public virtual async ValueTask <Tuple <ResponseStatus, object> > GetPlan(long planId) { var res = PlanManager.GetPlan(planId); return(new Tuple <ResponseStatus, object>( res != null ? ResponseStatus.Success : ResponseStatus.BadRequest, res)); }
public IHttpActionResult PostPlan(int code) { try { var result = PlanManager.GetPlan(code); return(Ok(result)); } catch (Exception) { return(NotFound()); } }
/// <summary> /// This method just show plan's data in fields of screen /// </summary> private void ShowPlan() { planManager = new PlanManager(this); originalPlan = planManager.GetPlan(Convert.ToInt32(Request["PlanId"])); txtName.Text = originalPlan.Name; ucDateTimeInterval.DateInterval = new DateTimeInterval(originalPlan.AvailableStartDate, originalPlan.AvailableEndDate); // cboBranch.SelectedValue = Convert.ToString(originalPlan.BranchId); cboApplication.SelectedValue = Convert.ToString(originalPlan.ApplicationId); cboPackage.SelectedValue = Convert.ToString(originalPlan.PackageId); }
/// <summary> /// This method fill an new plan object and send them to bd for update or insert /// </summary> private void SavePlan() { planManager = new PlanManager(this); plan = new DataClasses.Plan(); if (!String.IsNullOrEmpty(Request["PlanId"])) { plan = planManager.GetPlan(Convert.ToInt32(Request["PlanId"])); } plan.Name = txtName.Text; plan.AvailableStartDate = ucDateTimeInterval.DateInterval.BeginDate; plan.AvailableEndDate = ucDateTimeInterval.DateInterval.EndDate; plan.ApplicationId = Convert.ToInt32(cboApplication.SelectedValue); plan.PackageId = Convert.ToInt32(cboPackage.SelectedValue); planManager.Save(plan); Response.Redirect("Plans.aspx"); }