Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
        public void IsDayMatching_ShouldReturnFalse_WhenDayIsTomorrow()
        {
            var businessday  = new CheckDay(DateTime.Now.AddDays(1).DayOfWeek.ToString());
            var actualResult = businessday.IsDayMatching();

            Assert.IsFalse(actualResult);
        }
Ejemplo n.º 3
0
        public void IsDayMatchingTest_ShouldReturnFalse_WhenDayIsEmpty()
        {
            var businessday  = new CheckDay("");
            var actualResult = businessday.IsDayMatching();

            Assert.IsFalse(actualResult);
        }
Ejemplo n.º 4
0
        public void IsDayMatching_ShouldReturnTrue_WhenDayIsToday()
        {
            var businessday  = new CheckDay(DateTime.Now.DayOfWeek.ToString());
            var actualResult = businessday.IsDayMatching();

            Assert.IsTrue(actualResult);
        }
Ejemplo n.º 5
0
        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));
        }