Exemplo n.º 1
0
        public ActionResult Add(NotificationsTB NotificationsTB)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(View(NotificationsTB));
                }

                _INotification.DisableExistingNotifications();

                var Notifications = new NotificationsTB
                {
                    CreatedOn       = DateTime.Now,
                    Message         = NotificationsTB.Message,
                    NotificationsID = 0,
                    Status          = "A",
                    FromDate        = NotificationsTB.FromDate,
                    ToDate          = NotificationsTB.ToDate
                };

                _INotification.AddNotification(Notifications);

                MyNotificationHub.Send();
                return(RedirectToAction("Add", "AddNotification"));
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// The AddNotification
 /// </summary>
 /// <param name="entity">The entity<see cref="NotificationsTB"/></param>
 /// <returns>The <see cref="int"/></returns>
 public int AddNotification(NotificationsTB entity)
 {
     try
     {
         using (var _context = new DatabaseContext())
         {
             _context.NotificationsTBs.Add(entity);
             return(_context.SaveChanges());
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemplo n.º 3
0
 public IHttpActionResult Add(NotificationsTB NotificationsTB)
 {
     try
     {
         this._INotificationRepository.DisableExistingNotifications();
         var Notifications = new NotificationsTB
         {
             CreatedOn       = DateTime.Now,
             Message         = NotificationsTB.Message,
             NotificationsID = 0,
             Status          = "A",
             FromDate        = NotificationsTB.FromDate,
             ToDate          = NotificationsTB.ToDate
         };
         this._INotificationRepository.AddNotification(Notifications);
         // MyNotificationHub.Send();
         return(Ok());
     }
     catch (Exception)
     {
         throw;
     }
 }