public ActionResult Create(DailyReportViewModel dailyReportViewModel)
 {
     if (ModelState.IsValid)
     {
         var customer = this.session.Load<Customer>(dailyReportViewModel.CustomerId);
         var dailyReport = new DailyReport
         {
             Customer = customer,
             Date = dailyReportViewModel.Date,
             AfternoonEnd = dailyReportViewModel.AfternoonEnd ?? string.Empty,
             AfternoonStart = dailyReportViewModel.AfternoonStart ?? string.Empty,
             MorningEnd = dailyReportViewModel.MorningEnd ?? string.Empty,
             MorningStart = dailyReportViewModel.MorningStart ?? string.Empty,
             Notes = dailyReportViewModel.Notes ?? string.Empty,
             Offsite = dailyReportViewModel.Offsite
         };
         this.session.Save(dailyReport);
         return RedirectToAction("ManageReport", new {id = dailyReport.Id});
     }
     return View(dailyReportViewModel);
 }
        public void AddingANewActvity_PutsItInTheDb()
        {
            var controller = new DailyReportsController(this.session);
            string customerName = "Pippo1";
            var customer = new Customer {Name = customerName, VATNumber = "12345678901"};
            this.session.Save(customer);
            var dailyReport = new DailyReport
                {
                    Customer = customer,
                    MorningStart = "09:00",
                    MorningEnd = "13:00",
                    AfternoonStart = "14:00",
                    AfternoonEnd = "18:00",
                    Date = new DateTime(2012,12,11)
                };
            this.session.Save(dailyReport);

            var result = controller.ManageReport(1, new ActivityViewModel
                {
                    Description = "Corso Asp.Net Mvc",
                    Hours = 4m
                });

            this.session.Flush();
            
            var redirectResult = result as RedirectToRouteResult;
            var action = redirectResult.RouteValues["action"];
            action.Should().Be.EqualTo("ManageReport");


            var activityOnDb = this.session.Get<Activity>(1);
            activityOnDb.Should().Not.Be.Null();
        }