예제 #1
0
        public IActionResult deleteTask(int TaskId)
        {
            var task = new Task {
                Id = TaskId
            };

            _context.Task.Attach(task);
            _context.Task.Remove(task);
            _context.SaveChanges();
            var ss = _context.Task.ToArray();

            foreach (var item in ss)
            {
                item.Username = _context.User.Where(x => x.Id == item.UserId).Select(x => x.Displayname).FirstOrDefault();
            }
            return(Ok(ss));
        }
예제 #2
0
 public IActionResult createTask([FromBody] Task task)
 {
     _context.Task.Add(task);
     _context.SaveChanges();
     return(Ok());
 }