public string Get_endpoint(string endpoint) { bool EndpointExist = false; EndpointExist = Other_methods.The_existence_check(EndpointExist, endpoint); if (EndpointExist) { Models.Info info1 = new Models.Info(); List <string> gameModes = WorkSQL.Select_gameModes(endpoint); int i = 0; info1.gameModes = new string[gameModes.Count]; foreach (var a in gameModes) { info1.gameModes[i] = a; i++; } info1.name = WorkSQL.Select_name(endpoint)[0]; string serilized = JsonConvert.SerializeObject(info1); return(serilized); } else { return("404 Not Found"); } }
public void Put_info([ModelBinder] Models.Info putInfo, string endpoint) { HttpResponseMessage message = Request.CreateResponse(HttpStatusCode.OK); bool EndpointExist = false; EndpointExist = Other_methods.The_existence_check(EndpointExist, endpoint); if (EndpointExist) { WorkSQL.UPDATE_info(endpoint, putInfo.name); WorkSQL.DELETE_gameModes(endpoint); int i = 0; while (i < putInfo.gameModes.Length) { WorkSQL.Add_advertise_gameModes(endpoint, putInfo.gameModes[i]); i++; } } else { WorkSQL.Add_advertise_info(endpoint, putInfo.name); int j = 0; while (j < putInfo.gameModes.Length) { WorkSQL.Add_advertise_gameModes(endpoint, putInfo.gameModes[j]); j++; } } }
public ActionResult ThemInfo(Models.Info p) { if (ModelState.IsValid) { QuanLy ql = new QuanLy(); ql.AddInfo(p); return(RedirectToAction("Info")); } ViewBag.IDInfo = new SelectList(__db.Infos, "ID", "Name", p.ID); return(View(p)); }
public IHttpActionResult GetInfoById(int id) { Models.Info i = infos.FirstOrDefault(o => o.ID == id); if (i == null) { return(NotFound()); } else { return(Ok(i)); } }
//.........Xoá Type.........// public ActionResult XoaInfo(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Models.Info pro = __db.Infos.Find(id); if (pro == null) { return(HttpNotFound()); } return(View(pro)); }
public ActionResult Info() { DB.DBModel db = new DB.DBModel(); List <Models.Info> list = new List <Models.Info>(); var query = from i1 in db.Company join i2 in db.User on i1.ID equals i2.IDCompany orderby i1.Name select new { company = i1.Name, user = i2.Name, status = i2.StatusContract }; foreach (var a in query) { Models.Info item = new Models.Info() { Name = a.company, User = a.user, Status = a.status }; list.Add(item); } return(View("Info", list)); }
//.......Thêm Type........// public ActionResult ThemInfo() { Do_An.Models.Info info = new Models.Info(); ViewBag.IDInfo = new SelectList(__db.Infos, "ID", "Name"); return(View(info)); }
public void Post([FromBody] Models.Info info) { System.Diagnostics.Debug.WriteLine(info); Models.DataService.Add(info); }