public async Task <IActionResult> Edit(int id, [Bind("FamilyCardId,FamilyCardBalance,FamilyCardBonusPercent")] FamilyCard familyCard) { if (id != familyCard.FamilyCardId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(familyCard); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!FamilyCardExists(familyCard.FamilyCardId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(familyCard)); }
public ThirdCardGroup() { MedicineCard = new MedicineCard(); PhysiologicalCharacteristicsCard = new PhysiologicalCharacteristicsCard(); SportCard = new SportCard(); ContactsCard = new ContactsCard(); FamilyCard = new FamilyCard(); }
public async Task <IActionResult> Create([Bind("FamilyCardId,FamilyCardBalance,FamilyCardBonusPercent")] FamilyCard familyCard) { if (ModelState.IsValid) { _context.Add(familyCard); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(familyCard)); }
public ThirdCardGroup(MedicineCard medicineCard, PhysiologicalCharacteristicsCard physiologicalCharacteristicsCard, SportCard sportCard, ContactsCard contactsCard, FamilyCard familyCard) { if (medicineCard == null) { throw new ArgumentNullException(nameof(medicineCard)); } if (physiologicalCharacteristicsCard == null) { throw new ArgumentNullException(nameof(physiologicalCharacteristicsCard)); } if (sportCard == null) { throw new ArgumentNullException(nameof(sportCard)); } if (contactsCard == null) { throw new ArgumentNullException(nameof(contactsCard)); } if (familyCard == null) { throw new ArgumentNullException(nameof(familyCard)); } MedicineCard = medicineCard; PhysiologicalCharacteristicsCard = physiologicalCharacteristicsCard; SportCard = sportCard; ContactsCard = contactsCard; FamilyCard = familyCard; }
private ThirdCardGroup BuildThirdCardGroup() { var medicineCard = new MedicineCard() { Rank = _recruitInfo.MedicineInfo.Health.MedicineRank.ToMedicineRankString(), AdditionalRequirementsTable = _recruitInfo.MedicineInfo.Health.AdditionalRequirementsTableGraphs, DiseaseArticles = _recruitInfo.MedicineInfo.Health.DiseaseArticles, Vision = _recruitInfo.MedicineInfo.Health.Vision, BloodType = _recruitInfo.MedicineInfo.Health.BloodType.ToBloodTypeString() }; var physiologicalCharacteristicsCard = new PhysiologicalCharacteristicsCard() { Height = _recruitInfo.MedicineInfo.PhysiologicalCharacteristics.Height.ToString(), Weight = _recruitInfo.MedicineInfo.PhysiologicalCharacteristics.Weight.ToString(), HeadSize = _recruitInfo.MedicineInfo.PhysiologicalCharacteristics.HeadSize.ToString(), ClothingSize = _recruitInfo.MedicineInfo.PhysiologicalCharacteristics.ClothingSize, ShoesSize = _recruitInfo.MedicineInfo.PhysiologicalCharacteristics.ShoesSize.ToString() }; var sportCard = new SportCard() { Rank = _recruitInfo.MedicineInfo.SportInfo.Rank.ToSportRankString(), Kind = _recruitInfo.MedicineInfo.SportInfo.Kind }; var contactsCard = new ContactsCard() { HomePhone = _recruitInfo.Envelope.Contacts.HomeNumber.Value, MobilePhone = _recruitInfo.Envelope.Contacts.MobileNumber.Value }; var relativeInfoUIModels = new List <RelativeInfoCard>(); foreach (var relative in _recruitInfo.Envelope.FamilyInfo.Relatives) { var relativeInfoUIModel = new RelativeInfoCard() { RelativeStatus = relative.RelativeStatus.ToRelativeStatusString(), FullName = relative.PersonInfo.FullName.Value, BirthDate = relative.PersonInfo.BirthInfo.Date, BirthPlace = relative.PersonInfo.BirthInfo.Place, WorkPlace = relative.WorkPlace }; relativeInfoUIModels.Add(relativeInfoUIModel); } var familyCard = new FamilyCard() { ParentFamilyStatus = _recruitInfo.Envelope.FamilyInfo.ParentFamilyStatus.ToParentFamilyStatusString(), RelativeInfoUIModels = new ObservableCollection <RelativeInfoCard>(relativeInfoUIModels), SelectedRelativeInfoUIModel = relativeInfoUIModels.FirstOrDefault() }; return(new ThirdCardGroup(medicineCard, physiologicalCharacteristicsCard, sportCard, contactsCard, familyCard)); }