public async Task <IActionResult> Edit(int id, [Bind("ID,Date,Status")] CheckDay checkDay) { if (id != checkDay.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(checkDay); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CheckDayExists(checkDay.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(checkDay)); }
public void IsDayMatching_ShouldReturnFalse_WhenDayIsTomorrow() { var businessday = new CheckDay(DateTime.Now.AddDays(1).DayOfWeek.ToString()); var actualResult = businessday.IsDayMatching(); Assert.IsFalse(actualResult); }
public void IsDayMatchingTest_ShouldReturnFalse_WhenDayIsEmpty() { var businessday = new CheckDay(""); var actualResult = businessday.IsDayMatching(); Assert.IsFalse(actualResult); }
public void IsDayMatching_ShouldReturnTrue_WhenDayIsToday() { var businessday = new CheckDay(DateTime.Now.DayOfWeek.ToString()); var actualResult = businessday.IsDayMatching(); Assert.IsTrue(actualResult); }
public async Task <IActionResult> Create([Bind("ID,Status")] CheckDay checkDay, int studentId) { if (ModelState.IsValid) { var student = _context.Students.Find(studentId); checkDay.Students = student; checkDay.Date = DateTime.Now; _context.Add(checkDay); await _context.SaveChangesAsync(); return(RedirectToAction("Details", "Students", new { id = studentId })); } return(View(checkDay)); }