public FirstCommunionViewModel ToFirstCommunionViewModel(FirstCommunion firstCommunion) { return(new FirstCommunionViewModel { FirstCommunionDate = firstCommunion.FirstCommunionDate, Id = firstCommunion.Id, PlaceofEvent = firstCommunion.PlaceofEvent, Parishioner = firstCommunion.Parishioner, FatherName = firstCommunion.FatherName, FatherId = firstCommunion.FatherId, MotherName = firstCommunion.MotherName, MotherId = firstCommunion.MotherId, Comments = firstCommunion.Comments, CeremonialCelebrant = firstCommunion.CeremonialCelebrant, SacramentTypeId = firstCommunion.SacramentType.Id, SacramentTypes = _combosHelper.GetComboSacraments() }); }
public async Task <FirstCommunion> ToFirstCommunionAsync(FirstCommunionViewModel model, bool isNew) { var firstCommunion = new FirstCommunion { FirstCommunionDate = model.FirstCommunionDate, Id = isNew ? 0 : model.Id, PlaceofEvent = model.PlaceofEvent, FatherName = model.FatherName, FatherId = model.FatherId, MotherName = model.MotherId, Comments = model.Comments, CeremonialCelebrant = model.CeremonialCelebrant, Parishioner = await _dataContext.Parishioners.FindAsync(model.ParishionerId), SacramentType = await _dataContext.SacramentTypes.FindAsync(model.SacramentTypeId) }; return(firstCommunion); }