public async Task <AspNetUsersDocumentViewModel> Create(AspNetUsersDocumentViewModel documentViewModel) { AspNetUsersDocumentMapping aspNetUserDocument = ViewModelToEntityMapper.Map(documentViewModel); if (aspNetUserDocument != null) { aspNetUserDocument = this.AspNetUsersDocumentRepository.Add(aspNetUserDocument); if (aspNetUserDocument.DocumentId > 0) { documentViewModel.DocumentId = aspNetUserDocument.DocumentId; } else { documentViewModel.HasError = true; } } return(documentViewModel); }
public static AspNetUsersDocumentViewModel Map(AspNetUsersDocumentMapping entity) { if (entity == null) { return(null); } return(new AspNetUsersDocumentViewModel { DocumentId = entity.DocumentId, UserId = entity.UserId, FileType = entity.FileType, FileName = entity.FileName, FileLocation = entity.FileLocation, FileDisplayName = entity.FileDisplayName, CreatedBy = entity.CreatedBy, CreatedOn = entity.CreatedOn, LastModifiedBy = entity.LastModifiedBy, LastModifiedOn = entity.LastModifiedOn, IsActive = entity.IsActive }); }
public static AspNetUsersDocumentMapping Map(AspNetUsersDocumentViewModel viewModel, AspNetUsersDocumentMapping entity) { if (viewModel == null || entity == null) { return(null); } entity.DocumentId = viewModel.DocumentId; entity.UserId = viewModel.UserId; entity.FileType = viewModel.FileType; entity.FileName = viewModel.FileName; entity.FileLocation = viewModel.FileLocation; entity.FileDisplayName = viewModel.FileDisplayName; entity.CreatedBy = viewModel.CreatedBy; entity.CreatedOn = viewModel.CreatedOn; entity.LastModifiedBy = viewModel.LastModifiedBy; entity.LastModifiedOn = viewModel.LastModifiedOn; entity.IsActive = viewModel.IsActive; return(entity); }