Ejemplo n.º 1
0
        public void RepositoryHasNewData()
        {
            IMeetingRepository repository = new MockMeetingRepository();
            int initialCount = repository.GetAll().Count;

            Meeting meeting = new Meeting() { Title = "Meeting Title" };
            repository.Add(meeting);
            Assert.IsTrue(repository.GetAll().Count == initialCount + 1);
        }
Ejemplo n.º 2
0
 public Meeting Add(Meeting entity)
 {
     if (entity.Id == 0)
     {
         context.Meetings.Add(entity);
         context.SaveChanges();
     }
     return entity;
 }
Ejemplo n.º 3
0
 public ActionResult Delete(int id, Meeting meeting)
 {
     try
     {
         //When the user confirms delete handle the posted meeting delete.
         meetingRepository.Remove(id);
         return RedirectToAction("Index");
     }
     catch
     {
         return View(meeting);
     }
 }
Ejemplo n.º 4
0
 public ActionResult Create(Meeting meeting)
 {
     try
     {
         //Take tne new meeting which has been posted and save it.
         meetingRepository.Add(meeting);
         return RedirectToAction("Index");
     }
     catch
     {
         //If there is an exception return the form view.
         return View(meeting);
     }
 }
Ejemplo n.º 5
0
 public ActionResult Create(Meeting meeting)
 {
     if (ModelState.IsValid)
         {
             //Take tne new meeting which has been posted and save it.
             meetingRepository.Add(meeting);
             return RedirectToAction("Index");
         }
     else
         {
             //If there is an exception return the form view.
             return View(meeting);
         }
 }
Ejemplo n.º 6
0
 public Meeting Update(Meeting meeting)
 {
     Meeting dbMeeting = context.Meetings.Find(meeting.Id);
     if (dbMeeting != null)
     {
         dbMeeting.Title = meeting.Title;
         dbMeeting.Description = meeting.Description;
         dbMeeting.MeetingDate = meeting.MeetingDate;
         dbMeeting.MakeUpDate = meeting.MakeUpDate;
         dbMeeting.AttendeesExpectedCount = meeting.AttendeesExpectedCount;
         dbMeeting.AttendeesActualCount = meeting.AttendeesActualCount;
         dbMeeting.MeetingAdminEmailAddress = meeting.MeetingAdminEmailAddress;
         dbMeeting.ConfirmMeetingAdminEmailAddress = meeting.ConfirmMeetingAdminEmailAddress;
         context.SaveChanges();
     }
     return meeting;
 }
Ejemplo n.º 7
0
 // GET: Meetings/Create
 public ActionResult Create()
 {
     //Return the view which contains the form to enter a new meeting.
     var meeting = new Meeting();
     return View(meeting);
 }
Ejemplo n.º 8
0
 public ActionResult Edit(int id, Meeting meeting)
 {
     try
     {
         //Save the updated meeting which has been posted.
         meetingRepository.Update(meeting);
         return RedirectToAction("Index");
     }
     catch
     {
         return View(meeting);
     }
 }
Ejemplo n.º 9
0
 public ActionResult Edit(int id, Meeting meeting)
 {
     if (ModelState.IsValid)
     {
         try
         {
             //Save the updated meeting which has been posted.
             meetingRepository.Update(meeting);
             return RedirectToAction("Index");
         }
         catch
         {
             return View(meeting);
         }
     }
     else
     {
         //If there is a validation error return the form view.
         return View(meeting);
     }
 }
Ejemplo n.º 10
0
 public ActionResult EditModel(Meeting meeting)
 {
     //Return a view with a form containing the editable contents of the meeting ID Provided.
     meetingRepository.Update(meeting);
     return RedirectToAction("Index");
 }
Ejemplo n.º 11
0
 public ActionResult Edit(int id, Meeting meeting)
 {
     if (ModelState.IsValid)
     {
         //Save the updated meeting which has been posted.
         meetingRepository.Update(meeting);
         return RedirectToAction("Index");
     }
     else
     {
         return View(meeting);
     }
 }