Beispiel #1
0
        public MessageModel UpdateSingleEntity(BreedDrugVideoModel model)
        {
            Func <IEntityContext, string> operation = (context =>
            {
                var data = context.BreedDrugVideo.FirstOrDefault(m => m.VideoID == model.VideoID && m.ModifyTime == model.ModifyTime);
                if (data == null)
                {
                    return("当前数据不存在或被更新,请刷新后再次操作!");
                }

                data.VideoID = model.VideoID;
                data.DrugID = model.DrugID;
                data.Video = model.Video;
                data.Remark = model.Remark;
                data.IsLocked = model.IsLocked;
                data.IsShow = model.IsShow;
                data.ModifyID = UserManagement.CurrentUser.UserID;
                data.ModifyName = UserManagement.CurrentUser.UserName;
                data.ModifyTime = DateTime.Now;
                context.SaveChanges();
                return(string.Empty);
            });

            return(base.DbOperation(operation));
        }
Beispiel #2
0
        public MessageModel InsertSingleEntity(BreedDrugVideoModel model)
        {
            Func <IEntityContext, string> operation = (context => {
                model.ModifyID = UserManagement.CurrentUser.UserID;
                model.ModifyName = UserManagement.CurrentUser.UserName;
                model.ModifyTime = DateTime.Now;
                context.BreedDrugVideo.Add(model);
                context.SaveChanges();
                return(string.Empty);
            });

            return(base.DbOperation(operation));
        }
Beispiel #3
0
        /// <summary>
        /// 编辑单条BreedDrugVideo
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public MessageModel UpdateSingleBreedDrugVideo(BreedDrugVideoModel model)
        {
            var data = breedDrugVideoAccess.GetOriEntity(model.VideoID, model.ModifyTime);

            if (data == null)
            {
                return new MessageModel()
                       {
                           Message = "当前数据不存在或被更新,请刷新后再次操作!", Status = MessageStatus.Error
                       }
            }
            ;
            return(breedDrugVideoAccess.UpdateSingleEntity(model));
        }
    }
Beispiel #4
0
 /// <summary>
 /// 插入单条BreedDrugVideo
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public MessageModel InsertSingleBreedDrugVideo(BreedDrugVideoModel model)
 {
     return(breedDrugVideoAccess.InsertSingleEntity(model));
 }