Example #1
0
        public async Task<ActionResult> Create(Todo todo)
        {
            if (ModelState.IsValid)
            {
                await todoService.CreateAsync(todo);

                return RedirectToAction("Index");                
            }

            return View(todo);
        }
Example #2
0
        public async Task UpdateAsync(Todo item)
        {
            context.Entry<Todo>(item).State = EntityState.Modified;

            await context.SaveChangesAsync();
        }
Example #3
0
        public async Task CreateAsync(Todo item)
        {
            context.Todo.Add(item);

            await context.SaveChangesAsync();
        }
Example #4
0
        public async Task<IHttpActionResult> Put(Todo item)
        {
            await todoService.UpdateAsync(item);

            return Ok();
        }