public IHttpActionResult PutSmartBoard(int id, SmartBoard smartBoard) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != smartBoard.Uid) { return(BadRequest()); } db.Entry(smartBoard).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!SmartBoardExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PostSmartBoard(SmartBoard smartBoard) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.SmartBoards.Add(smartBoard); try { db.SaveChanges(); } catch (DbUpdateException) { if (SmartBoardExists(smartBoard.Uid)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = smartBoard.Uid }, smartBoard)); }
public IHttpActionResult GetSmartBoard(int id) { SmartBoard smartBoard = db.SmartBoards.Find(id); if (smartBoard == null) { return(NotFound()); } return(Ok(smartBoard)); }
public IHttpActionResult DeleteSmartBoard(int id) { SmartBoard smartBoard = db.SmartBoards.Find(id); if (smartBoard == null) { return(NotFound()); } db.SmartBoards.Remove(smartBoard); db.SaveChanges(); return(Ok(smartBoard)); }
public async Task CreateSmartboard(SmartBoard obj) { await _webApi.Create(obj); }
public async Task UpdateSmartboard(int key, SmartBoard obj) { await _webApi.Update(key, obj); }
/// <summary> /// Tilføjer et udstyr /// </summary> public async void AddEquipment() { if (TypeOfEquipment == "Computer" || TypeOfEquipment == "Smartboard" || TypeOfEquipment == "Smartphone" || TypeOfEquipment == "Tablet") { Equipment e = new Equipment(TypeOfEquipment); await Singleton.Instance.EQP.CreateEquipment(e); AllEquipment = Singleton.Instance.EQP.GetEquipments().Result; Equipment NewlyCreatedEquip = AllEquipment.Last(); switch (TypeOfEquipment) { case "Computer": Computer pc = new Computer(NewlyCreatedEquip.Uid); await Singleton.Instance.COM.CreateComputer(pc); var messageDialogue1 = new MessageDialog($"En computer er tilføjet"); messageDialogue1.Commands.Add(new UICommand("Luk")); await messageDialogue1.ShowAsync(); break; case "Smartboard": SmartBoard sb = new SmartBoard(NewlyCreatedEquip.Uid); await Singleton.Instance.SB.CreateSmartboard(sb); var messageDialogue2 = new MessageDialog($"Et smartboard er tilføjet"); messageDialogue2.Commands.Add(new UICommand("Luk")); await messageDialogue2.ShowAsync(); break; case "Smartphone": SmartPhone sp = new SmartPhone(NewlyCreatedEquip.Uid); await Singleton.Instance.SP.CreateSmartphone(sp); var messageDialogue3 = new MessageDialog($"En smartphone er tilføjet"); messageDialogue3.Commands.Add(new UICommand("Luk")); await messageDialogue3.ShowAsync(); break; case "Tablet": Tablet tab = new Tablet(NewlyCreatedEquip.Uid); await Singleton.Instance.TAB.CreateTablet(tab); var messageDialogue4 = new MessageDialog($"En tablet er tilføjet"); messageDialogue4.Commands.Add(new UICommand("Luk")); await messageDialogue4.ShowAsync(); break; default: break; } } else { throw new ArgumentException("TypeOfEquipment is null"); } ObsEquipment.Clear(); ConvertToObs(); }