public async Task <IActionResult> CreateCourse([FromBody] Cell Cell)
 {
     using (var context = new PrisonDbContext())
     {
         context.Cells.Add(Cell);
         await context.SaveChangesAsync();
     }
     return(Ok());
 }
Exemple #2
0
        public async Task <IActionResult> UpdateStudent([FromBody] Prisoner prisoner)
        {
            using (var context = new PrisonDbContext())
            {
                context.Prisoners.Update(prisoner);
                await context.SaveChangesAsync();

                return(Ok());
            }
        }
        public async Task <IActionResult> UpdateCell([FromBody] Cell cell)
        {
            using (var context = new PrisonDbContext())
            {
                context.Cells.Update(cell);
                await context.SaveChangesAsync();

                return(Ok());
            }
        }
Exemple #4
0
        public async Task <IActionResult> DeletePrisoner([FromQuery] int id)
        {
            using (var context = new PrisonDbContext())
            {
                var prisoner = await context.Prisoners.FirstOrDefaultAsync(x => x.Id == id);

                context.Prisoners.Remove(prisoner);
                await context.SaveChangesAsync();

                return(Ok());
            }
        }