Esempio n. 1
0
        public IHttpActionResult PutPinLocation(short lid, PinLocation pinLocation)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (lid != pinLocation.PinId)
            {
                return(BadRequest());
            }

            db.Entry(pinLocation).State = EntityState.Modified;

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Esempio n. 2
0
 public PinGroup(IGraphBlock block, string id, PinLocation location, string caption)
 {
     Block    = block;
     Id       = id;
     Location = location;
     Caption  = caption;
 }
Esempio n. 3
0
        public PinGroup(IGraphBlock block, string id, PinLocation location, string caption)
        {
            Block    = block;
            Id       = id;
            Location = location;
            Caption  = caption;

            H <PinGroup> .Initialize(this);
        }
Esempio n. 4
0
        public void Inject(IGraphBlock block, string id, PinLocation location, string caption)
        {
            H <PinGroup> .Initialize(this);

            Block    = block;
            Id       = id;
            Location = location;
            Caption  = caption;
        }
Esempio n. 5
0
        public IHttpActionResult PostPinLocation(PinLocation pinLocation)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.PinLocation.Add(pinLocation);
            db.SaveChanges();
            return(Ok(pinLocation.PinId));

            //return CreatedAtRoute("DefaultApi", new { id = pinLocation.PinId }, pinLocation);
        }
Esempio n. 6
0
        public IHttpActionResult DeletePinLocation(short lid)
        {
            PinLocation pinLocation = db.PinLocation.Find(lid);

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

            db.PinLocation.Remove(pinLocation);
            db.SaveChanges();

            return(Ok(pinLocation));
        }
Esempio n. 7
0
 public IPinGroup GetOrAddGroup(string id, PinLocation location, string caption = "")
 {
     // TODO : new to Ioc
     return(Groups.GetOrAdd(g => g.Id == id,
                            () => _getPinGroup(this, id, location, caption)));
 }