protected override void OnNavigatedTo(NavigationEventArgs e) { var viewModel = new Listmodel(); DataContext = viewModel; MainPage.is_NewInstance = false; }
public Register() { var viewModel = new Listmodel(); DataContext = viewModel; InitializeComponent(); }
public async Task <IActionResult> Delete(Listmodel id) { var model = await database.Listmodels.FindAsync(id.ImageId); database.Listmodels.Remove(model); await database.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); }
public IActionResult Index(Listmodel model) { if (ModelState.IsValid) { Listmodel lst = new Listmodel(); string photoname = null; if (model.Photo != null) { string folderpath = Path.Combine(_hostingEnvironment.WebRootPath, "Images"); photoname = Guid.NewGuid().ToString() + "_" + model.Photo.FileName; string photopath = Path.Combine(folderpath, photoname); lst.Photopath = photoname; model.Photo.CopyTo(new FileStream(photopath, FileMode.Create)); lst.Name = model.Name; database.Listmodels.Add(lst); database.SaveChanges(); } } return(RedirectToAction("Index")); }
protected override void OnNavigatedTo(NavigationEventArgs e) { var viewModel = new Listmodel(); DataContext = viewModel; }