Esempio n. 1
0
        public ActionResult Save(MemberM model, IFormFile Member_Photo_Files, IFormFile Member_FilePath_Fiels)
        {
            //接收图片
            if (Member_Photo_Files != null)
            {
                this.HandleUpFile(Member_Photo_Files, new string[] { ".jpg", ".gif", ".png" }, _WebRootPath, null, (_Path) =>
                {
                    model.Member_Photo = _Path;
                });
            }

            //接收文件
            if (Member_FilePath_Fiels != null)
            {
                this.HandleUpFile(Member_FilePath_Fiels, null, _WebRootPath, null, (_Path) =>
                {
                    model.Member_FilePath = _Path;
                });
            }

            //判断是否有文件上传上来
            //if (Member_Photo_Files.Count > 0)
            //{
            //    foreach (var item in Member_Photo_Files)
            //    {
            //        this.HandleUpFile(item, new string[] { ".jpg", ".gif", ".png" }, _WebRootPath, null, (_Path) =>
            //         {
            //             model.Member_Photo = _Path;
            //         });
            //    }
            //}

            this.KeyID = _MemberBL.Save(model);
            return(Json(new { status = 1, ID = KeyID }));
        }
Esempio n. 2
0
        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public string Save(MemberM model)
        {
            if (model.Member_ID.ToGuid().Equals(Guid.Empty))
            {
                model.Member_ID = db.Add(model, li).ToGuid();
                if (model.Member_ID.Equals(Guid.Empty))
                {
                    throw new MessageBox(db.ErrorMessge);
                }
            }
            else
            {
                if (!db.EditById(model, li))
                {
                    throw new MessageBox(db.ErrorMessge);
                }
            }
            if (!db.Commit(li))
            {
                throw new MessageBox(db.ErrorMessge);
            }

            return(model.Member_ID.ToGuidStr());
        }