public ActionResult AgencyAdd() { var model = new T_Agency(); var bll = new T_AgencyBll(); if (Request.QueryString["AgencyId"] != null) { model = bll.GetModel(int.Parse(Request.QueryString["AgencyId"].ToString())); } else { model.IsShow = 1; } return(View(model)); }
public Dictionary <string, object> Add(T_Agency model) { model.CreateUserId = ManageProvider.Provider.Current().UserId; model.CreateUserName = ManageProvider.Provider.Current().Account; model.CreateTime = DateTime.Now; if (model.AgencyId > 0) { var model1 = bll.GetModel(model.AgencyId); model1.AgencyName = model.AgencyName; model1.SortCode = model.SortCode; model1.IsShow = model.IsShow; if (bll.Update(model1) > 0) { return(new Dictionary <string, object> { { "code", "1" } }); } else { return(new Dictionary <string, object> { { "code", "0" } }); } } else { if (bll.Add(model) > 0) { return(new Dictionary <string, object> { { "code", "1" } }); } else { return(new Dictionary <string, object> { { "code", "0" } }); } } }