public ActionResult CalendarAdminAddEdit(Guid? id) {
			Guid ItemGuid = id ?? Guid.Empty;

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

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

			return View("CalendarAdminAddEdit", model);
		}
		public ActionResult CalendarAdminAddEdit(tblCalendar 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 ActionResult CalendarAdminAdd(tblCalendar model) {
			return CalendarAdminAddEdit(model);
		}
 partial void DeletetblCalendar(tblCalendar instance);
		public ActionResult CalendarAdminDelete(tblCalendar 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");
		}
 partial void UpdatetblCalendar(tblCalendar instance);
 partial void InserttblCalendar(tblCalendar instance);
Example #8
0
 partial void DeletetblCalendar(tblCalendar instance);
Example #9
0
 partial void UpdatetblCalendar(tblCalendar instance);
Example #10
0
 partial void InserttblCalendar(tblCalendar instance);