Example #1
0
        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); };
        }
Example #2
0
        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);
        }
Example #3
0
 public AltaActivoPage()
 {
     InitializeComponent();
     BindingContext = new AssetCreateViewModel(Navigation);
 }