Ejemplo n.º 1
0
        public string InsertNotification(int Id, int jobID, int appId,
                                         string message, string status)
        {
            var notify = db.Notifications.Where(n => n.ServiceId.Equals(Id)).FirstOrDefault();

            if (notify != null)
            {
                //do nothing
                return("not successful. record duplicate");
            }
            else
            {
                //insert notifications
                db.Notifications.Add(new Notifications
                {
                    ServiceId = Id,
                    JobId     = jobID,
                    AppId     = appId,
                    //Recipient = recipient,
                    Message = message,
                    //SendDT = sendDt,
                    Status = status
                });

                db.SaveChanges();

                return("successful");
            }
        }
Ejemplo n.º 2
0
        public ActionResult Create([Bind(Include = "Id,ServiceId,JobId,AppId,Recipient,Message,SendDT,Status")] Notifications notifications)
        {
            if (ModelState.IsValid)
            {
                db.Notifications.Add(notifications);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(notifications));
        }
Ejemplo n.º 3
0
        public string updateRecord(int serviceId)
        {
            using (ChatServerModelContainer context = new ChatServerModelContainer())
            {
                // "id" is the id in your table (parameter passed)

                Notifications jnr = context.Notifications.Where(n => n.ServiceId.Equals(serviceId)).FirstOrDefault();
                jnr.Status = "Sent";
                context.Entry(jnr).State = EntityState.Modified;
                context.SaveChanges();
                return("Sent");
            }
        }