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

                data.VideoID = model.VideoID;
                data.HealthID = model.HealthID;
                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(BreedHealthVideoModel model)
        {
            Func <IEntityContext, string> operation = (context => {
                model.ModifyID = UserManagement.CurrentUser.UserID;
                model.ModifyName = UserManagement.CurrentUser.UserName;
                model.ModifyTime = DateTime.Now;
                context.BreedHealthVideo.Add(model);
                context.SaveChanges();
                return(string.Empty);
            });

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

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