コード例 #1
0
        public ActionResult GetSubject(int Id)
        {
            EventSubjectDTO subject = new EventSubjectDTO();

            using (MABRUKLISTEntities dbcontext = new MABRUKLISTEntities())
            {
                var details = dbcontext.mblist_events_detail.Find(Id);
                if (details != null)
                {
                    subject.EventId      = Id;
                    subject.EventSubject = details.event_subject;
                }
            };
            return(PartialView("_GetSubject", subject));
        }
コード例 #2
0
 public ActionResult UpdateSubject(EventSubjectDTO subject)
 {
     try
     {
         using (MABRUKLISTEntities dbcontext = new MABRUKLISTEntities())
         {
             var details = dbcontext.mblist_events_detail.Find(subject.EventId);
             if (details != null)
             {
                 details.event_subject = subject.EventSubject;
                 dbcontext.SaveChanges();
                 return(Json(new { key = true, value = "Subject updated successfully", eventkey = details.event_detail_key }, JsonRequestBehavior.AllowGet));
             }
             else
             {
                 return(Json(new { key = false, value = "Event not found" }, JsonRequestBehavior.AllowGet));
             }
         };
     }
     catch (Exception e)
     {
         return(Json(new { key = false, value = "Unable to process your request.Please contact your admin" }, JsonRequestBehavior.AllowGet));
     }
 }