public ActionResult Create(SysAppTypeEntity model) { try { if (ModelState.IsValid) { model.AppTypeId = Convert.ToInt32(Request.Form["AppTypeId"]); if (logic.GetAppTypeInfo(model.AppTypeId) == null) { model.TypeName = Request.Form["TypeName"]; logic.AddAppType(model); return(this.RefreshParent()); } else { return(this.Back("重复的应用类型编号:" + model.AppTypeId)); } } return(View()); } catch (Exception ex) { return(this.Back("新增应用类型该模块发生异常。" + ex.Message)); } }
public int AddAppType(SysAppTypeEntity model) { string sql = "INSERT INTO SysAppType(AppTypeId,TypeName) VALUES(@AppTypeId,@TypeName)"; using (var conn = new SqlConnection(ConnectionStr.FxDb)) { conn.Open(); return(conn.Execute(sql, model)); } }
public int UpdateAppType(SysAppTypeEntity model) { string sql = "UPDATE SysAppType SET TypeName=@TypeName WHERE AppTypeId=@AppTypeId"; using (var conn = new SqlConnection(ConnectionStr.FxDb)) { conn.Open(); return(conn.Execute(sql, model)); } }
public ActionResult Edit(int id, FormCollection collection) { try { if (ModelState.IsValid) { SysAppTypeEntity model = new SysAppTypeEntity(); model.AppTypeId = id; model.TypeName = collection["TypeName"]; logic.UpdateAppType(model); return(this.RefreshParent()); } return(View()); } catch (Exception ex) { return(this.Back("修改应用类型该模块发生异常。" + ex.Message)); } }
public int AddAppType(SysAppTypeEntity model) { return(appTypeDal.AddAppType(model)); }
public int UpdateAppType(SysAppTypeEntity model) { return(appTypeDal.UpdateAppType(model)); }