Example #1
0
 public HttpResponseMessage create(Notification_tb nottif)
 {
     try
     {
         var res = new HttpResponseMessage(HttpStatusCode.OK);
         db.Notification_tb.Add(nottif);
         db.SaveChanges();
         return(res);
     }
     catch
     {
         return(new HttpResponseMessage(HttpStatusCode.BadRequest));
     }
 }
Example #2
0
 public HttpResponseMessage Update(Notification_tb notifi)
 {
     try
     {
         var res             = new HttpResponseMessage(HttpStatusCode.OK);
         var newNotification = db.Notification_tb.Single(p => p.id == notifi.id);
         newNotification.id      = notifi.id;
         newNotification.subjec  = notifi.subjec;
         newNotification.content = notifi.content;
         newNotification.lang    = notifi.lang;
         db.SaveChanges();
         return(res);
     }
     catch
     {
         return(new HttpResponseMessage(HttpStatusCode.BadRequest));
     }
 }