コード例 #1
0
ファイル: BLLVideo.cs プロジェクト: nguyenhoanghai/QMS_System
 public int AddFile(string connectString, Q_Video model)
 {
     using (var db = new QMSSystemEntities(connectString))
     {
         db.Q_Video.Add(model);
         db.SaveChanges();
         return(model.Id);
     }
 }
コード例 #2
0
        public JsonResult Save(Q_Video model)
        {
            ResponseBase res = new ResponseBase();

            try
            {
                int id = BLLVideo.Instance.AddFile(AppGlobal.Connectionstring, model);
                if (id == 0)
                {
                    JsonDataResult.Result = "ERROR";
                    JsonDataResult.ErrorMessages.AddRange(res.Errors);
                }
                else
                {
                    JsonDataResult.Result = "OK";
                }
            }
            catch (Exception ex)
            {
                throw (ex);
            }
            return(Json(JsonDataResult));
        }