예제 #1
0
        public async Task <IActionResult> PutHabit(int id, Habit habit)
        {
            if (id != habit.Id)
            {
                return(BadRequest());
            }

            _context.Entry(habit).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!HabitExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task <IActionResult> PutTasksHistory(int id, TasksHistory tasksHistory)
        {
            if (id != tasksHistory.Id)
            {
                return(BadRequest());
            }

            _context.Entry(tasksHistory).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!TasksHistoryExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }