public void UpdateStatus(Guid id, ReminderItemStatus status)
 {
     using (var context = new ReminderStorageContext(_builder.Options))
     {
         ReminderItemDto dto = context.ReminderItems.Find(id);
         dto.Status = status;
         context.SaveChanges();
     }
 }
Пример #2
0
 public void UpdateStatus(Guid id, ReminderItemStatus status)
 {
     using (var context = new ReminderStorageContext(_builder.Options))
     {
         var reminderItem = context.ReminderItem.FirstOrDefault(ri => ri.Id.Equals(id));
         reminderItem.Status = status;
         context.SaveChanges();
     }
 }
        public Guid Add(ReminderItemRestricted reminder)
        {
            var dto = new ReminderItemDto();

            using (var context = new ReminderStorageContext(_builder.Options))
            {
                context.ReminderItems.Add(dto);
                context.SaveChanges();
                return(dto.Id);
            }
        }
Пример #4
0
 public void UpdateStatus(IEnumerable <Guid> ids, ReminderItemStatus status)
 {
     using (var context = new ReminderStorageContext(_builder.Options))
     {
         var reminderItems = context.ReminderItem.Where(ri => ids.Contains(ri.Id)).ToList();
         foreach (var dto in reminderItems)
         {
             dto.Status = status;
         }
         context.SaveChanges();
     }
 }
Пример #5
0
        public void UpdateStatus(Guid id, ReminderItemStatus status)
        {
            using (var context = new ReminderStorageContext(_builder.Options))
            {
                var reminder = context.ReminderItems.FirstOrDefault(r => r.Id == id);

                if (reminder != null)
                {
                    reminder.Status = status;
                    context.SaveChanges();
                }
            }
        }
Пример #6
0
        public void UpdateStatus(IEnumerable <Guid> ids, ReminderItemStatus status)
        {
            using (var context = new ReminderStorageContext(_builder.Options))
            {
                var reminders = context.ReminderItems.Where(r => ids.Contains(r.Id)).ToList().Select(r => { r.Status = status; return(r); }).ToList();

                //foreach (var reminder in reminders)
                //{
                //    reminder.Status = status;
                //}
                context.SaveChanges();
            }
        }
Пример #7
0
 public bool Remove(Guid id)
 {
     using (var context = new ReminderStorageContext(_builder.Options))
     {
         var reminder = context.ReminderItem.FirstOrDefault(ri => ri.Id.Equals(id));
         if (reminder == null)
         {
             return(false);
         }
         context.ReminderItem.Remove(reminder);
         context.SaveChanges();
         return(true);
     }
 }
        public bool Remove(Guid id)
        {
            using (var context = new ReminderStorageContext(_builder.Options))
            {
                var dto = context.ReminderItems.FirstOrDefault(r => r.Id == id);
                if (dto == null)
                {
                    return(false);
                }

                context.ReminderItems.Remove(dto);
                context.SaveChanges();
                return(true);
            }
        }
Пример #9
0
        public Guid Add(ReminderItemRestricted reminder)
        {
            var reminderDto = new ReminderItemDto
            {
                ContactId  = reminder.ContactId,
                TargetDate = reminder.Date,
                Message    = reminder.Message,
                Status     = reminder.Status
            };

            using (var context = new ReminderStorageContext(_builder.Options))
            {
                context.ReminderItems.Add(reminderDto);
                context.SaveChanges();
                return(reminderDto.Id);
            }
        }