/// <summary> /// Initializes a new instance of the <see cref="ChildCat" /> class. /// </summary> /// <param name="name">name.</param> /// <param name="petType">petType (required) (default to PetTypeEnum.ChildCat).</param> public ChildCat(string name = default(string), PetTypeEnum petType = PetTypeEnum.ChildCat) : base() { this._PetType = petType; this._Name = name; if (this.Name != null) { this._flagName = true; } this.AdditionalProperties = new Dictionary <string, object>(); }
/// <summary> /// List of Owner Gender with Pet Names By Type /// </summary> /// <param name="petTypeEnum"></param> /// <returns></returns> public async Task <SummaryByPetTypeVM> GetListGroupByAsync(PetTypeEnum petTypeEnum) { try { // return list of person data with all pets var people = await _peopleRepository.GetListAsync(); // return group by gender and list pet names alphabetically var petSummary = people.Where(x => x.Pets.Any(q => q.Type == petTypeEnum)) .OrderBy(x => x.Gender) .Select(x => new { Gender = x.Gender, Pets = x.Pets.Where(y => y.Type == petTypeEnum) }) .GroupBy(x => x.Gender, x => x.Pets, (key, group) => new { Gender = key, Pets = group.SelectMany(q => q) } ) .Select(x => new SummaryItemVM() { Gender = x.Gender, PetNames = x.Pets.OrderBy(q => q.Name).Select(q => q.Name).ToList() }).ToList(); return(new SummaryByPetTypeVM() { Items = petSummary }); } catch (System.Exception ex) { throw ex; } }
/// <summary> /// Initializes a new instance of the <see cref="ChildCat" /> class. /// </summary> /// <param name="name">name.</param> /// <param name="petType">petType (required) (default to PetTypeEnum.ChildCat).</param> public ChildCat(string name = default(string), PetTypeEnum petType = PetTypeEnum.ChildCat) : base() { this.PetType = petType; this.Name = name; }
/// <summary> /// Initializes a new instance of the <see cref="ChildCatAllOf" /> class. /// </summary> /// <param name="name">name.</param> /// <param name="petType">petType (default to PetTypeEnum.ChildCat).</param> public ChildCatAllOf(string name = default, PetTypeEnum petType = PetTypeEnum.ChildCat) { this.Name = name; this.PetType = petType; this.AdditionalProperties = new Dictionary <string, object>(); }
private void UpdatePetType(PetTypeEnum type) { PetType = type; RaisePropertyChanged(nameof(PetType)); }
public async void Create(int petAge, double petDifficulty, string petName, double petWeight, PetTypeEnum petType, string petBreed, string userId) { var user = _context.Users .Include(p => p.Pets) .FirstOrDefault(i => i.Id == userId); if (user != null) { var pet = new Pet { PetWeight = petWeight, PetType = petType, PetAge = petAge, PetName = petName, PetBreed = petBreed, PetDifficulty = petDifficulty }; if (!user.IsPetOwner) { user.IsPetOwner = true; } user.Pets.Add(pet); _context.Add(pet); await _context.SaveChangesAsync(); } else { throw new NullReferenceException(); } }
/// <summary> /// Initializes a new instance of the <see cref="ChildCat" /> class. /// </summary> /// <param name="petType">petType (required) (default to PetTypeEnum.ChildCat).</param> /// <param name="name">name.</param> public ChildCat(PetTypeEnum petType = PetTypeEnum.ChildCat, string name = default) : base() { this.PetType = petType; this.Name = name; this.AdditionalProperties = new Dictionary <string, object>(); }
/// <summary> /// Initializes a new instance of the <see cref="ChildCatAllOf" /> class. /// </summary> /// <param name="name">name</param> /// <param name="petType">petType (default to PetTypeEnum.ChildCat)</param> public ChildCatAllOf(string name = default, PetTypeEnum petType = PetTypeEnum.ChildCat) { Name = name; PetType = petType; }