예제 #1
0
        public ActionResult CalendarAdminAddEdit(CalendarDetail model)
        {
            if (ModelState.IsValid)
            {
                ModelState.Clear();

                var itm = (from c in db.tblCalendars
                           where c.CalendarID == model.CalendarID &&
                           SiteID == this.SiteID
                           select c).FirstOrDefault();

                if (itm == null || model.CalendarID == Guid.Empty)
                {
                    itm = new tblCalendar {
                        SiteID     = this.SiteID,
                        CalendarID = Guid.NewGuid(),
                        EventDate  = DateTime.Now.Date
                    };

                    db.tblCalendars.InsertOnSubmit(itm);
                }

                itm.EventDate   = model.EventDate;
                itm.EventTitle  = model.EventTitle;
                itm.EventDetail = model.EventDetail;
                itm.IsActive    = model.IsActive;

                db.SubmitChanges();

                return(RedirectToAction("CalendarAdminAddEdit", new { @id = itm.CalendarID }));
            }

            return(View("CalendarAdminAddEdit", model));
        }
예제 #2
0
        public JsonResult SelectCalenderDetail(CalendarDetail _param)
        {
            List <CalendarDetail> lCalendarDetails = DaoFactory.GetList <CalendarDetail>("Manage.SelCalenderDetail", new CalendarDetail {
                CalendarOID = _param.CalendarOID
            });

            return(Json(lCalendarDetails));
        }
예제 #3
0
        public ActionResult CalendarAdminDelete(CalendarDetail model)
        {
            var itm = (from c in db.tblCalendars
                       where c.CalendarID == model.CalendarID &&
                       SiteID == this.SiteID
                       select c).FirstOrDefault();

            db.tblCalendars.DeleteOnSubmit(itm);
            db.SubmitChanges();

            return(RedirectToAction("Index"));
        }
예제 #4
0
        public ActionResult CalendarAdminAddEdit(Guid?id)
        {
            Guid ItemGuid = id ?? Guid.Empty;

            CalendarDetail model = (from c in db.tblCalendars
                                    where c.CalendarID == ItemGuid &&
                                    SiteID == this.SiteID
                                    select new CalendarDetail(c)).FirstOrDefault();

            if (model == null)
            {
                model = new CalendarDetail {
                    SiteID     = this.SiteID,
                    CalendarID = Guid.Empty,
                    IsActive   = true,
                    EventDate  = DateTime.Now.Date
                };
            }

            return(View("CalendarAdminAddEdit", model));
        }
예제 #5
0
 public ActionResult CalendarAdminAdd(CalendarDetail model)
 {
     return(CalendarAdminAddEdit(model));
 }