public AssetCreate() { InitializeComponent(); viewmodel = new AssetCreateViewModel(); DataContext = viewmodel; Value_Category.SetType(typeof(AssetCategory)); Value_ParentID.SetType(typeof(Asset)); Value_AssignedTo.SetType(typeof(User)); Value_Category.PropertyChanged += (s, e) => { viewmodel.OnCategoryChanged(Value_Category.CurrentSelection); }; Value_ParentID.PropertyChanged += (s, e) => { viewmodel.OnParentAssetChanged(Value_ParentID.CurrentSelection); }; Value_AssignedTo.PropertyChanged += (s, e) => { viewmodel.OnUserChanged(Value_AssignedTo.CurrentSelection); }; }
private string ProcessUploadedAssetFile(AssetCreateViewModel model) { string uniqueFileName = null; if (model.Photo != null) { string uploadsFolder = Path.Combine(_webHostEnvironment.WebRootPath, "images"); uniqueFileName = Guid.NewGuid().ToString() + "_" + model.Photo.FileName; string filePath = Path.Combine(uploadsFolder, uniqueFileName); using (var fileStream = new FileStream(filePath, FileMode.Create)) { model.Photo.CopyTo(fileStream); } } return(uniqueFileName); }
public AltaActivoPage() { InitializeComponent(); BindingContext = new AssetCreateViewModel(Navigation); }