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)); }
public JsonResult SelectCalenderDetail(CalendarDetail _param) { List <CalendarDetail> lCalendarDetails = DaoFactory.GetList <CalendarDetail>("Manage.SelCalenderDetail", new CalendarDetail { CalendarOID = _param.CalendarOID }); return(Json(lCalendarDetails)); }
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")); }
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)); }
public ActionResult CalendarAdminAdd(CalendarDetail model) { return(CalendarAdminAddEdit(model)); }