public static OperationResult AddPlateColors(VehicleMaintainAddModel model, int CreateUserID) { List <SqlParameter> paras = new List <SqlParameter>() { new SqlParameter("@Code", SqlDbType.TinyInt), new SqlParameter("@Name", SqlDbType.NVarChar, 30), new SqlParameter("@CreateUserID", SqlDbType.Int) }; paras[0].Value = model.PlateCode; paras[1].Value = model.PlateColor; paras[2].Value = CreateUserID; #region SQL string sql = @"INSERT INTO dbo.PlateColors ( Code ,Name,CreateUserID) VALUES ( @Code , @Name,@CreateUserID)"; #endregion bool result = MSSQLHelper.ExecuteNonQuery(CommandType.Text, sql, paras.ToArray()) > 0; return(new OperationResult() { Success = result, Message = result ? PromptInformation.OperationSuccess : PromptInformation.DBError }); }
public ActionResult AddPlateColors(VehicleMaintainAddModel model) { if (ModelState.IsValid) { var result = VehicleMaintainBLL.AddPlateColors(model, base.UserIDForLog); base.DoLog(OperationTypeEnum.Add, result, "PlateColors:" + model.PlateCode); return(Json(result)); } else { return(PartialView("_AddPlateColorGrid", model)); } }