public ActionResult Edit(int id) { try { ViewBag.Saved = false; Models.SalutationModel mSalutation = new SalutationModel() { SalutationId = 0 }; CLayer.Salutation staycategory = BLayer.Salutation.Get(id); if (staycategory != null) { mSalutation = new SalutationModel() { SalutationId = staycategory.SalutationId, Title = staycategory.Title } } ; return(PartialView("_Edit", mSalutation)); } catch (Exception ex) { Common.LogHandler.HandleError(ex); return(Redirect("~/Admin/ErrorPage")); } }
public ActionResult Edit(Models.SalutationModel data) { try { if (ModelState.IsValid) { CLayer.Salutation salutation = new CLayer.Salutation() { SalutationId = data.SalutationId, Title = data.Title }; BLayer.Salutation.Save(salutation); ViewBag.Saved = true; } else { ViewBag.Saved = false; } return(RedirectToAction("Index")); } catch (Exception ex) { Common.LogHandler.HandleError(ex); return(Redirect("~/Admin/ErrorPage")); } }
public int Save(CLayer.Salutation salutation) { List <DataPlug.Parameter> param = new List <DataPlug.Parameter>(); param.Add(Connection.GetParameter("pSalutationId", DataPlug.DataType._Int, salutation.SalutationId)); param.Add(Connection.GetParameter("pTitle", DataPlug.DataType._Varchar, salutation.Title)); int result = Connection.ExecuteQuery("salutation_Save", param); return(result); }
public CLayer.Salutation Get(int SalutationId) { CLayer.Salutation salutation = null; List <DataPlug.Parameter> param = new List <DataPlug.Parameter>(); param.Add(Connection.GetParameter("pSalutationId", DataPlug.DataType._BigInt, SalutationId)); DataTable dt = Connection.GetTable("salutation_Get", param); if (dt.Rows.Count > 0) { salutation = new CLayer.Salutation(); salutation.SalutationId = Connection.ToLong(dt.Rows[0]["SalutationId"]); salutation.Title = Connection.ToString(dt.Rows[0]["Title"]); } return(salutation); }
public static int Save(CLayer.Salutation salutation) { DataLayer.Salutation salutationS = new DataLayer.Salutation(); salutation.Validate(); return(salutationS.Save(salutation)); }