public void AutoFill() { if (autoFill_r == null) { autoFill_r = new Random(); autoFill_cID = autoFill_r.Next(2, 99); } foreach (var item in listOfTables.Children) { autoFill_sID++; if (item is Controls.TablesControl) { var mod = new Models.TableModelN(); mod.Team.Class = autoFill_cID.ToString(); mod.Team.Time = $"{autoFill_r.Next(0, 23).ToString().PadLeft(2, '0')}:{autoFill_r.Next(0, 59).ToString().PadLeft(2, '0')}:{autoFill_r.Next(0, 59).ToString().PadLeft(2, '0')}"; mod.School.Name = "Min Skole #" + autoFill_sID; for (int i = 0; i < 3; i++) { var p = new Models.PersonModel(); p.Name = $"Person{i}_{autoFill_sID}"; mod.Persons.Add(p); } (item as Controls.TablesControl).Model = mod; } } }
// GET: /<controller>/ public IActionResult Index() { Models.PersonModel model = new Models.PersonModel(); model.FirstName = "John"; model.LastName = "Smith"; return View(model); }
// PUT: api/AgeRanger/5 public void Put(int id, [FromBody] Models.PersonModel value) { // Wouldn't normally do mapping here. var p = new AgeRangerEntities.Person() { Id = value.Id, First = value.FirstName, Last = value.LastName, Age = value.Age }; GetRepo().AddPerson(p); }
public HomeController() { this.person = new Models.PersonModel { UniqueId = 123234, FirstName = "Jarek", LastName = "Stadnicki", Country = "Polska", City = "Wrocław", Sex = Sex.Male }; }
public async static Task DeletePerson(Models.PersonModel person) { var group = AllData.FirstOrDefault(x => x.Id.Equals(person.ParentId)); if (group != null) { if (person.Id != default(Guid)) { group.People.Remove(group.People.FirstOrDefault(x => x.Id == person.Id)); } } var strGuid = group.Id.ToString(); Application.Current.Properties[strGuid] = Newtonsoft.Json.JsonConvert.SerializeObject(group); await Application.Current.SavePropertiesAsync(); }
public static List <PersonModel> ConvertToPersonModels(this List <string> lines) { List <PersonModel> output = new List <PersonModel>(); foreach (string line in lines) { string[] cols = line.Split(','); PersonModel p = new Models.PersonModel(); p.Id = int.Parse(cols[0]); p.FirstName = cols[1]; p.LastName = cols[2]; p.EmailAddress = cols[3]; p.CellphoneNumber = cols[4]; output.Add(p); } return(output); }