Exemple #1
0
        public void UpdateCheckListRecord(User user, string ticks, DateTime today)
        {
            RoutineWorkRecord update = GetCheckListRecord(user, today);

            if (update != null)
            {
                update.work_Ticks = ticks;
                db.RoutineWorkRecords.Attach(update);
                db.Entry(update).State = EntityState.Modified;
                db.SaveChanges();
            }
        }
Exemple #2
0
        public int AddCheckListRecord(User user, string ticks, DateTime today)
        {
            if (!(db.RoutineWorkRecords.Where(x => x.user_id == user.id && x.add_date == today).Count() > 0))
            {
                RoutineWorkRecord record = new RoutineWorkRecord()
                {
                    user_id    = user.id,
                    add_date   = today,
                    work_Ticks = ticks
                };
                db.RoutineWorkRecords.Add(record);
                db.SaveChanges();

                return(record.id);
            }
            return(0);
        }