public FormViewModel Build(Form form) { return new FormViewModel() { Id = form.Id, Name = this.handler.Storage.GetRepository<ILocalizationRepository>().FilteredByDictionaryId(form.NameId).First().Value, Fields = this.handler.Storage.GetRepository<IFieldRepository>().FilteredByFormId(form.Id).Select( f => new FieldViewModelBuilder(this.handler).Build(f) ) }; }
public Form Map(CreateOrEditViewModel createOrEdit) { Form form = new Form(); if (createOrEdit.Id != null) form = this.handler.Storage.GetRepository<IFormRepository>().WithKey((int)createOrEdit.Id); form.Code = createOrEdit.Code; form.Email = createOrEdit.Email; return form; }