Beispiel #1
0
        public Task Create(ViewModels.TaskViewModel model)
        {
            if (ToadyCount() < 5)
            {
                Task entity = new Task();
                entity.Start = model.Start;

                entity.End = model.Start.AddHours(8);
                entity.EndTimeZone = entity.End.ToString("yyyy-MM-dd");
                entity.StartTimeZone = model.Start.ToString("yyyy-MM-dd");

                //entity.Title = model.Title;
                entity.Description = model.Description;
                entity.MemberID = model.MemberID;
                entity.AddUser = CookieHelper.MemberID;
                entity.AddTime = DateTime.Now;
                if (model.MemberID != CookieHelper.MemberID)
                {
                    entity.IsOtherAdd = true;
                }
                db.Add<Task>(entity);
                db.Commit();
                return entity;
            }
            else
            {
                throw new Exception("当天任务安排不能超过5条");
            }
        }
Beispiel #2
0
        public void Update(Task model)
        {
            var target = Find(model.ID);
            db.Attach<Task>(target);
            target.Start = model.Start;
            target.End = model.End;
            target.EndTimeZone = model.EndTimeZone;
            target.StartTimeZone = model.StartTimeZone;

            target.Title = model.Title;
            target.Description = model.Description;
            db.Commit();
        }
Beispiel #3
0
 public void Delete(Task model)
 {
     var target = Find(model.ID);
     db.Remove<Task>(target);
     db.Commit();
 }
Beispiel #4
0
 public void Create(Task model)
 {
     db.Add<Task>(model);
     db.Commit();
 }