public ActionResult DeleteConfirmed(int id) { UnavailableDate unavailableDate = db.UnavailableDates.Find(id); db.UnavailableDates.Remove(unavailableDate); db.SaveChanges(); return(RedirectToAction("MyDates")); }
public CalendarEvent(UnavailableDate unavailableDate) { id = unavailableDate.Id; url = ""; title = unavailableDate.Sibling.FirstName; @class = "event-warning"; start = (long)(unavailableDate.Busydate.AddHours(5) - DateTime.Parse("1970-01-01")).TotalMilliseconds; end = (long)(unavailableDate.Busydate.AddDays(1).AddMinutes(-1) - DateTime.Parse("1970-01-01")).TotalMilliseconds; }
// GET: UnavailableDates/Create public ActionResult Create() { var model = new UnavailableDate { SiblingId = User.Identity.GetUserId(), Busydate = DateTime.Today }; return(View(model)); }
public ActionResult Edit([Bind(Include = "Id,SiblingId,Busydate")] UnavailableDate unavailableDate) { if (ModelState.IsValid) { db.Entry(unavailableDate).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("MyDates")); } ViewBag.SiblingId = new SelectList(db.Siblings, "Id", "FirstName", unavailableDate.SiblingId); return(View(unavailableDate)); }
public ActionResult Create([Bind(Include = "Id,SiblingId,Busydate")] UnavailableDate unavailableDate) { if (ModelState.IsValid) { db.UnavailableDates.Add(unavailableDate); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.SiblingId = new SelectList(db.Siblings, "Id", "FirstName", unavailableDate.SiblingId); return(View(unavailableDate)); }
// GET: UnavailableDates/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } UnavailableDate unavailableDate = db.UnavailableDates.Find(id); if (unavailableDate == null) { return(HttpNotFound()); } return(View(unavailableDate)); }
public async Task <int> InsertDbNonWorkingDayAsync(UnavailableDate unavailableDate) { try { db.UnavailableDates.Add(unavailableDate); await db.SaveChangesAsync(); return(1); } catch (Exception) { throw; } }
// GET: UnavailableDates/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } UnavailableDate unavailableDate = db.UnavailableDates.Find(id); if (unavailableDate == null) { return(HttpNotFound()); } ViewBag.SiblingId = new SelectList(db.Siblings, "Id", "FirstName", unavailableDate.SiblingId); return(View(unavailableDate)); }
public UnavailableDate GetUnavailableDate(string dateFrom, string dateTo, string guiderId) { UnavailableDate unavailableDate = new UnavailableDate(); try { unavailableDate.GuiderID = guiderId; unavailableDate.UnavailableDateEntry = DateTime.Now; unavailableDate.UnavailableFrom = DateTime.ParseExact(dateFrom, "yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture); unavailableDate.UnavailableTo = DateTime.ParseExact(dateTo, "yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture); } catch (Exception) { throw; } return(unavailableDate); }
public async Task <JsonResult> AddNonWorkingDay(string dateFrom, string dateTo) { string guiderId = User.Identity.GetUserId(); UnavailableDate unavailableDate = new UnavailableDate(); try { unavailableDate = accountService.GetUnavailableDate(dateFrom, dateTo, guiderId); await accountService.InsertDbNonWorkingDayAsync(unavailableDate); } catch (Exception e) { Debug.Print(e.Message); //Debuger return(Json(new { success = false, responseText = "There was an error, the data did not store!" }, JsonRequestBehavior.AllowGet)); } return(Json(new { success = true, responseText = "Your message successfuly sent!" }, JsonRequestBehavior.AllowGet)); }
public Task <OperationResult <UnavailableDate> > UpdateAsync(UnavailableDate input) => _apiClient.PutAsync <UnavailableDate, OperationResult <UnavailableDate> >(URL, input);