public TallboyBLL.Models.ContainerPart GetContainerPart(int id) { using (var ctx = new TallboyDBContext()) { var containerPart = ctx.ContainerParts.FirstOrDefault(t => t.Id == id); if (containerPart == null) { throw new TallboyServerException("Can't find ContainerPart with the ID: " + id.ToString() + " in the database."); } return(containerPart); } }
public List <TallboyBLL.Models.ContainerPart> GetContainerParts() { using (var ctx = new TallboyDBContext()) { var containerPart = ctx.ContainerParts.ToList(); if (containerPart == null) { throw new TallboyServerException("Can't finda any ContainerPart in the database."); } return(containerPart); } }
public List <TallboyBLL.Models.TaskElement> GetTaskElement() { using (var ctx = new TallboyDBContext()) { var taskElement = ctx.TaskElements.ToList(); if (taskElement == null) { throw new TallboyServerException("Can't find any TaskElement in the database."); } return(taskElement); } }
public TallboyBLL.Models.TaskElement GetTaskElement(int id) { using (var ctx = new TallboyDBContext()) { var taskElement = ctx.TaskElements.FirstOrDefault(t => t.Id == id); if (taskElement == null) { throw new TallboyServerException("Can't find TaskElement with the ID: " + id.ToString() + " in the database."); } return(taskElement); } }
public List <TallboyBLL.Models.TaskElement> GetTaskElementToTask(int id) { using (var ctx = new TallboyDBContext()) { var taskElements = ctx.TaskElements.Where(t => t.TaskId == id).ToList(); if (taskElements == null) { throw new TallboyServerException("Can't find any Taskelement in the database to the task"); } return(taskElements); } }
public List <TallboyBLL.Models.Task> GetTask() { using (var ctx = new TallboyDBContext()) { var task = ctx.Tasks.ToList(); if (task == null) { throw new TallboyServerException("Can't find Task in the database."); } return(task); } }
public List <TallboyBLL.Models.ContainerPartContent> GetContainerPartContentToType(int id) { using (var ctx = new TallboyDBContext()) { var containerPartContent = ctx.ContainerPartContents.Where(t => t.TypeId == id).ToList(); if (containerPartContent == null) { throw new TallboyServerException("Any ContainerPartContent don't have TaskId: " + id.ToString() + " in the database."); } return(containerPartContent); } }
public TallboyBLL.Models.Type GetType(int id) { GenerateTestData(); using (var ctx = new TallboyDBContext()) { var types = ctx.Types.FirstOrDefault(t => t.Id == id); if (types == null) { throw new TallboyServerException("Can't find Type with the ID: " + id.ToString() + " in the database."); } return(types); } }
public List <TallboyBLL.Models.Type> GetTypeList() { GenerateTestData(); using (var ctx = new TallboyDBContext()) { var types = ctx.Types.ToList(); if (types == null) { throw new TallboyServerException("Can't find any Type in the database."); } return(types); } }
public void GenerateTestData() { using (var ctx = new TallboyDBContext()) { if (!ctx.Types.Any()) { ctx.Types.AddRange(new List <TallboyBLL.Models.Type> { new TallboyBLL.Models.Type { Name = "Szimering", Description = "CORTECO 8,8/12,2" }, new TallboyBLL.Models.Type { Name = "Akkumulátor", Description = "Bosch" }, new TallboyBLL.Models.Type { Name = "Kerékcsapágy", Description = "FEBI Kúpgörgős csapágy" } }); ctx.SaveChanges(); } } }