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);
        }
        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);
        }
Beispiel #3
0
 public void newRestrictedArea(MapRestricted res)
 {
     Clients.All.newRestrictedArea(res);
 }