Exemple #1
0
        public async Task <IActionResult> Create([Bind("Id,Date,DailyHabit,Intention,Feedback")] Habit habit)
        {
            if (ModelState.IsValid)
            {
                _context.Add(habit);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(habit));
        }
        public async Task <IActionResult> Create([Bind("Id,Name,WorkDate")] Work work)
        {
            if (ModelState.IsValid)
            {
                work.Id = Guid.NewGuid();
                _context.Add(work);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(work));
        }