public void Modify(object item)
        {
            if (item as SchedulerItem != null || item as SchedulerMessage != null || item as SchedulerSettings != null)
            {
                dbContext.Entry(item).State = EntityState.Modified;
            }

            else
            {
                throw new Exception("Wrong type.");
            }
        }
Пример #2
0
        public void Modify(object item)
        {
            if (item as EmailMessage != null)
            {
                dbContext.Entry(item).State = EntityState.Modified;
            }

            else
            {
                throw new Exception("Wrong type.");
            }
        }
 public ActionResult Edit([Bind(Include = "id,type,value,time,enabled")] Notification notification)
 {
     if (ModelState.IsValid)
     {
         db.Entry(notification).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(notification));
 }
Пример #4
0
        /// <summary>
        /// Send message.
        /// </summary>
        /// <param name="message">All fields of message should be correct to ensure ef updates the correct data.</param>
        /// <returns></returns>
        public virtual async Task <BaseResponse> Send(TMessage message)
        {
            var rsp = await Sender.Send(message);

            if (Db.Entry(message).State == EntityState.Detached)
            {
                Db.Attach(message);
            }
            message.TryTimes++;
            if (rsp.Code != 0)
            {
                message.Status = MessageStatus.Failed;
            }
            else
            {
                message.Status = MessageStatus.Succeed;
                message.SendDt = DateTime.Now;
            }
            await Db.SaveChangesAsync();

            return(rsp);
        }
Пример #5
0
 public void Edit_Notification(Notification model)
 {
     _notificationCtx.Entry(model).State =
         EntityState.Modified;
 }