Esempio n. 1
0
        public async Task <IActionResult> DeleteLocation(int id)
        {
            var location = await db.Locations.Where(l => l.Id.Equals(id)).SingleOrDefaultAsync();

            db.Locations.Remove(location);
            try{
                await db.SaveChangesAsync();

                return(Ok(id));
            }catch {
                return(StatusCode(400));
            }
        }
Esempio n. 2
0
        public async Task <IActionResult> DeleteUser(int id)
        {
            var user = await db.Users.Where(u => u.Id.Equals(id)).Include(u => u.Roles).SingleOrDefaultAsync();

            db.Users.Remove(user);
            try{
                await db.SaveChangesAsync();

                return(Ok(id));
            }catch {
                return(StatusCode(400));
            }
        }