public ActionResult TotalFee(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            StudyMeeting studyMeeting = db.StudyMeetings.Find(id);

            var model = new StudyMeetingTotalFeeViewModels();

            model.Participants = studyMeeting.Participants;
            studyMeeting.Participants.ForEach(x =>
            {
                var fee                      = studyMeeting.CalcFee(x);
                model.EstSeminarFee         += fee.SeminarFee;
                model.EstSocialGatheringFee += fee.SocialGatheringFee;
                if (x.CheckedIn)
                {
                    model.ResSeminarFee         += fee.SeminarFee;
                    model.ResSocialGatheringFee += fee.SocialGatheringFee;
                }
            });

            return(View(model));
        }
Beispiel #2
0
 public void SetUp()
 {
     sut = new StudyMeeting()
     {
         SeminarFee                   = 500,
         SocialGatheringFee           = 4000,
         SocialGatheringFeeForStudent = 3000
     };
 }
 public ActionResult Edit([Bind(Include = "Id,Title,Date,SeminarFee,SocialGatheringFee,SocialGatheringFeeForStudent")] StudyMeeting studyMeeting)
 {
     if (ModelState.IsValid)
     {
         db.Entry(studyMeeting).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(studyMeeting));
 }
        public ActionResult Create([Bind(Include = "Id,Title,Date,SeminarFee,SocialGatheringFee,SocialGatheringFeeForStudent")] StudyMeeting studyMeeting)
        {
            if (ModelState.IsValid)
            {
                db.StudyMeetings.Add(studyMeeting);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(studyMeeting));
        }
        // GET: /StudyMeeting/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            StudyMeeting studyMeeting = db.StudyMeetings.Find(id);

            if (studyMeeting == null)
            {
                return(HttpNotFound());
            }
            return(View(studyMeeting));
        }
Beispiel #6
0
        // POST: /Participant/Add/5
        public ActionResult Add(int id, Participant participant)
        {
            StudyMeeting studyMeeting = db.StudyMeetings.Find(id);

            if (ModelState.IsValid)
            {
                studyMeeting.Participants.Add(participant);
                db.SaveChanges();
                return(RedirectToAction("Add", new { Id = id }));
            }

            var model = new ParticipantAddViewModel
            {
                StudyMeeting = studyMeeting,
                Participants = studyMeeting.Participants.ToList()
            };

            return(View(model));
        }
Beispiel #7
0
        // GET: /Participant/Add/5
        public ActionResult Add(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            StudyMeeting studyMeeting = db.StudyMeetings.Find(id);

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

            var model = new ParticipantAddViewModel
            {
                StudyMeeting = studyMeeting,
                Participants = studyMeeting.Participants.ToList(),
            };

            return(View(model));
        }