Exemplo n.º 1
0
        public async Task <ActionResult> DeleteConfirmed(
            [Bind(Include = "MeetingID, MeetingName, Reason, CanCancel")]
            MeetingCancelViewModel model)
        {
            if (ModelState.IsValidField("Reason"))
            {
                Meeting meeting = await db.Meetings.FindAsync(model.MeetingID);

                meeting.IsCanceled = true;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(model));
        }
Exemplo n.º 2
0
        public async Task <ActionResult> Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Meeting meeting = await db.Meetings.FindAsync(id);

            if (meeting == null)
            {
                return(HttpNotFound());
            }

            MeetingCancelViewModel model = new MeetingCancelViewModel();

            model.MeetingID   = meeting.MeetingID;
            model.MeetingName = meeting.MeetingName;
            model.CanCancel   = meeting.StartTime > DateTime.Now;

            return(View(model));
        }