public List <RepairView> GetRepairsByTechnicianId(TechnicianView r) { string URIPart; try { URIPart = URIparts[typeof(RepairView)]; } catch (Exception e) { MessageBox.Show(e.Message, "NULL vagy kulcs nem létezik hiba", MessageBoxButton.OK); return(null); } var result = httpClient.GetAsync(baseUri + URIPart + "/" + r.Id.ToString()).Result; if (!result.IsSuccessStatusCode) { MessageBox.Show(result.Content.ToString(), result.ReasonPhrase); } var rawContent = result.Content.ReadAsStringAsync().Result; var parserSettings = new JsonSerializerSettings { ReferenceLoopHandling = ReferenceLoopHandling.Ignore, MaxDepth = null }; var obj = JsonConvert.DeserializeObject <List <RepairView> >(rawContent, parserSettings); return(obj); }
public void UpdateTechnician(TechnicianView tv) { using var ctx = new WorkshopContext(); var t = ctx.Technicians.Single(t => t.Id == tv.Id); t.Id = tv.Id; t.Name = tv.Name; t.PhoneNumber = tv.PhoneNumber; t.UserId = tv.UserId; }
public void AddTechnician(TechnicianView tv) { using var ctx = new WorkshopContext(); Technician t = new Technician(); t.Name = tv.Name; t.PhoneNumber = tv.PhoneNumber; t.User = ctx.Users.Single(u => u.Id == tv.User.Id); t.UserId = t.User.Id; }
public bool ValidateUser(UserView u) { var valid = workshopClient.ValidateUser(u); TechnicianView tech = (from techs in Technicians ?? new List <TechnicianView>() where techs.User.Username == u.Username select techs).FirstOrDefault(); CurrentTechnician = tech; return(valid && tech != null); }
public static TechnicianView GetViewModell(Technician t) { TechnicianView tv = new TechnicianView(); if (t != null) { tv.Id = t.Id; tv.Name = t.Name; tv.PhoneNumber = t.PhoneNumber; tv.RepairTechnicians = t.RepairTechnicians?.Select(br => GetViewModell(br)).ToList(); tv.User = GetViewModell(t.User); } return(tv); }
public IEnumerable <RepairView> GetRepairsByTechnicianId(TechnicianView t) { return(workshopClient.GetRepairsByTechnicianId(t)); }