public void TestPeriodName() { //Arrange Period period = new Period(); period.Month = 1; period.Year = 2012; //Act string result = period.Name; //Assert Assert.AreEqual("01 - 2012", result, "The name method returned a different Value"); }
public ActionResult Create(Period period) { if (ModelState.IsValid) { _unitOfWork.PeriodRepository.Insert(period); var employees = _unitOfWork.EmployeeRepository.Get(i => i.LeaveDate == null); foreach (var item in employees) { MonthlyCost monthlyCost = new MonthlyCost { Employee = item, Period = period }; _unitOfWork.MonthlyCostRepository.Insert(monthlyCost); } _unitOfWork.Save(); return RedirectToAction("Index"); } return View(period); }
public ActionResult Edit(Period period) { if (ModelState.IsValid) { _unitOfWork.PeriodRepository.Update(period); _unitOfWork.Save(); return RedirectToAction("Index"); } return View(period); }