Exemplo n.º 1
0
        public IHttpActionResult PutMapRestricted(int id, MapRestricted mapRestricted)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != mapRestricted.Id)
            {
                return(BadRequest());
            }

            db.Entry(mapRestricted).State = System.Data.Entity.EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!MapRestrictedExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemplo n.º 2
0
        public IHttpActionResult GetMapRestricted(int id)
        {
            MapRestricted mapRestricted = db.MapRestrictedSet.Find(id);

            if (mapRestricted == null)
            {
                return(NotFound());
            }

            return(Ok(mapRestricted));
        }
Exemplo n.º 3
0
        public IHttpActionResult DeleteMapRestricted(int id)
        {
            MapRestricted mapRestricted = db.MapRestrictedSet.Find(id);

            if (mapRestricted == null)
            {
                return(NotFound());
            }

            db.MapRestrictedSet.Remove(mapRestricted);
            db.SaveChanges();

            return(Ok(mapRestricted));
        }
Exemplo n.º 4
0
        public IHttpActionResult PostMapRestricted(MapRestricted mapRestricted)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.MapRestrictedSet.Add(mapRestricted);
            db.SaveChanges();

            var context = GlobalHost.ConnectionManager.GetHubContext <VehicleHub>();

            context.Clients.All.newRestrictedArea(mapRestricted);

            return(CreatedAtRoute("DefaultApi", new { id = mapRestricted.Id }, mapRestricted));
        }
Exemplo n.º 5
0
 public void newRestrictedArea(MapRestricted res)
 {
     Clients.All.newRestrictedArea(res);
 }