public ResultViewModels <PackageEditViewModel> AddPackage(PackageEditViewModel PackageEditView) { ResultViewModels <PackageEditViewModel> result = new ResultViewModels <PackageEditViewModel>(); try { var packageTemp = packageService.Add(PackageEditView); if (packageTemp == null) { result.Successed = false; result.Message = "Data is empty"; } else { result.Successed = true; result.Message = "Data added"; result.Data = packageTemp; } } catch (Exception ex) { result.Successed = false; result.Message = "Something Went Wrong !!"; } return(result); }
protected void btnSave_Click(object sender, EventArgs e) { try { Page.Validate("AddEdit"); if (Page.IsValid) { if (gvwDetail.Rows.Count > 0) { switch (RowID) { case 0: PackageService.Add( txtName.Text, Convert.ToInt32(ddlDuesInMonth.SelectedValue), chkIsActive.Checked, chkOpenEnd.Checked, Convert.ToDecimal(txtFreezeFee.Value.GetValueOrDefault()), Detail); break; default: PackageService.Update( RowID, txtName.Text, Convert.ToInt32(ddlDuesInMonth.SelectedValue), chkIsActive.Checked, chkOpenEnd.Checked, Convert.ToDecimal(txtFreezeFee.Value.GetValueOrDefault()), Detail); break; } Refresh(); } else { WebFormHelper.SetLabelTextWithCssClass( lblMessageDetail, "Detail of package must have one or more items", LabelStyleNames.ErrorMessage); } } } catch (Exception ex) { WebFormHelper.SetLabelTextWithCssClass(lblMessage, ex.Message, LabelStyleNames.ErrorMessage); LogService.ErrorException(GetType().FullName, ex); } }
public PackageEditViewModel AddPackage(PackageEditViewModel PackageEditView) { var package = packageService.Add(PackageEditView); return(package); }