Example #1
0
        public IHttpActionResult Put_object(int id, _object _object)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Example #2
0
        public ActionResult DeleteConfirmed(int id)
        {
            _object _object = db.objects.Find(id);

            db.objects.Remove(_object);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #3
0
 //_protocol = 0 = UDP, _protocol = 1 = TCP
 public void SetServerOptions(string _ip = "127.0.0.1", string _port = "15937", int _protocol = 0)
 {
     //Sets up a local UDP server as default
     IpAddress.Value  = _ip;
     ServerPort.Value = _port;
     //Sets UDP as default internet protocol
     InternetProtocols.SelectedIndex = _protocol;//sets the list on UDP
     XProtocol = ComboBoxProtocols.SelectedItem;
 }
Example #4
0
 public ActionResult Edit([Bind(Include = "id,name")] _object _object)
 {
     if (ModelState.IsValid)
     {
         db.Entry(_object).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(_object));
 }
Example #5
0
        public IHttpActionResult Get_object(int id)
        {
            _object _object = db.objects.Find(id);

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

            return(Ok(_object));
        }
Example #6
0
        public ActionResult Create([Bind(Include = "id,name")] _object _object)
        {
            if (ModelState.IsValid)
            {
                db.objects.Add(_object);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(_object));
        }
Example #7
0
        public IHttpActionResult Post_object(_object _object)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.objects.Add(_object);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = _object.id }, _object));
        }
Example #8
0
        public IHttpActionResult Delete_object(int id)
        {
            _object _object = db.objects.Find(id);

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

            db.objects.Remove(_object);
            db.SaveChanges();

            return(Ok(_object));
        }
Example #9
0
        // GET: _object/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            _object _object = db.objects.Find(id);

            if (_object == null)
            {
                return(HttpNotFound());
            }
            return(View(_object));
        }
Example #10
0
 set => SetProperty(ref _object, value);
Example #11
0
 /*
  * After the ObservableList is created we choose here at which index
  * should reference, or rather, which faction should be picked and
  * showed in the selection scene. This operation doesn't work in the
  * Initialize method (the overrided one) called above.
  * **/
 private void Start()
 {
     FactionsList.SelectedIndex = 1;
     XFaction = ComboBoxFactions.SelectedItem;
 }