コード例 #1
0
        public void Put(int id, [FromBody] jobTask model)
        {
            var single = (from a in _context.Task
                          where a.Id == id
                          select new jobTask
            {
                Id = a.Id,
                Title = a.Title,
                Description = a.Description,
                IsComplete = a.IsComplete,
                CreatedDate = a.CreatedDate,
                Percentage = a.Percentage
            }).FirstOrDefault();

            if (single != null)
            {
                single.IsComplete  = model.IsComplete;
                single.Title       = model.Title;
                single.Description = model.Description;
                single.Percentage  = model.Percentage;
            }
            _context.Update(single);
            _context.SaveChanges();
        }
コード例 #2
0
 public void Post([FromBody] jobTask model)
 {
     model.CreatedDate = DateTime.Now;
     _context.Add(model);
     _context.SaveChanges();
 }