public ChristeningViewModel ToChristeningViewModel(Christening christening) { return(new ChristeningViewModel { ChristeningDate = christening.ChristeningDate, Id = christening.Id, PlaceofEvent = christening.PlaceofEvent, Parishioner = christening.Parishioner, FatherName = christening.FatherName, FatherId = christening.FatherId, MotherName = christening.MotherName, MotherId = christening.MotherId, GodFatherName = christening.GodFatherName, GodFatherId = christening.GodFatherId, GodMotherName = christening.GodMotherName, GodMotherId = christening.GodMotherId, Comments = christening.Comments, CeremonialCelebrant = christening.CeremonialCelebrant, ParishionerId = christening.Parishioner.Id, SacramentTypeId = christening.SacramentType.Id, SacramentTypes = _combosHelper.GetComboSacraments() }); }
public async Task <Christening> ToChristeningAsync(ChristeningViewModel model, bool isNew) { var christening = new Christening { ChristeningDate = model.ChristeningDate, Id = isNew ? 0 : model.Id, PlaceofEvent = model.PlaceofEvent, FatherName = model.FatherName, FatherId = model.FatherId, MotherName = model.MotherName, MotherId = model.MotherId, GodFatherName = model.GodFatherName, GodFatherId = model.GodFatherId, GodMotherName = model.GodMotherName, GodMotherId = model.GodMotherId, Comments = model.Comments, CeremonialCelebrant = model.CeremonialCelebrant, Parishioner = await _dataContext.Parishioners.FindAsync(model.ParishionerId), SacramentType = await _dataContext.SacramentTypes.FindAsync(model.SacramentTypeId) }; return(christening); }