예제 #1
0
        public ActionResult ProblemsAndSuggestions(Model.ProblemsAndSuggestions ProblemsAndSuggestions)
        {
            Business.Sys_ProblemsAndSuggestions Sys_ProblemsAndSuggestions = new Business.Sys_ProblemsAndSuggestions();
            HttpPostedFileBase file = Request.Files["main_img"];

            if (file != null)
            {
                ProblemsAndSuggestions.PhotoList = Utility.ChangeText.SaveUploadPicture(file, "attach");
            }
            ProblemsAndSuggestions.State    = 1;
            ProblemsAndSuggestions.RealName = Utility.ChangeText.GetRealName();
            ProblemsAndSuggestions.UsersId  = Utility.ChangeText.GetUsersId();
            if (Sys_ProblemsAndSuggestions.InsertProblemsAndSuggestions(ProblemsAndSuggestions))
            {
                ViewData["success"] = "添加成功";
            }
            return(View());
        }
예제 #2
0
        /// <summary>
        /// 写入一条记录
        /// </summary>
        /// <param name="ProblemsAndSuggestions"></param>
        /// <returns></returns>
        public bool InsertProblemsAndSuggestions(Model.ProblemsAndSuggestions ProblemsAndSuggestions)
        {
            const string sql =
                @"INSERT INTO ProblemsAndSuggestions(UsersId,RealName,Problems,Suggestions,PhotoList,phone,Address,State) 
 VALUES(@UsersId,@RealName,@Problems,@Suggestions,@PhotoList,@phone,@Address,@State)";

            return(Factory.DBHelper.ExecSQL(SQLConString, sql.ToString(), new DynamicParameters(new
            {
                ProblemsAndSuggestions.UsersId,
                ProblemsAndSuggestions.RealName,
                ProblemsAndSuggestions.Problems,
                ProblemsAndSuggestions.Suggestions,
                ProblemsAndSuggestions.PhotoList,
                ProblemsAndSuggestions.phone,
                ProblemsAndSuggestions.Address,
                ProblemsAndSuggestions.State
            })));
        }