public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Attach(UserSeat).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!UserSeatExists(UserSeat.UserId)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Seat.Add(Seat); await _context.SaveChangesAsync(); return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.ArenaEventTifoPartScreen.Add(ArenaEventTifoPartScreen); await _context.SaveChangesAsync(); return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } Tifo = await _context.Tifo.FindAsync(id); if (Tifo != null) { _context.Tifo.Remove(Tifo); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } ArenaEvent = await _context.ArenaEvent.FindAsync(id); if (ArenaEvent != null) { _context.ArenaEvent.Remove(ArenaEvent); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(string id) { if (id == null) { return(NotFound()); } UserSeat = await _context.UserSeat.FindAsync(id); if (UserSeat != null) { _context.UserSeat.Remove(UserSeat); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } if (Tifo.MyUploadedFile.FileName != null) { var uniqueFileName = GetUniqueFileName(Tifo.MyUploadedFile.FileName); var documentroot = Path.Combine(hostingEnvironment.WebRootPath, "tifos"); var fullpath = Path.Combine(documentroot, uniqueFileName); Tifo.MyUploadedFile.CopyTo(new FileStream(fullpath, FileMode.Create)); //to do : Save uniqueFileName to your db table Tifo.Title = Tifo.MyUploadedFile.FileName; Tifo.Path = uniqueFileName; Tifo.ContentType = Tifo.MyUploadedFile.ContentType; Tifo.LengthOfMedia = Tifo.MyUploadedFile.Length; if (ModelState.IsValid) { _context.Add(Tifo); await _context.SaveChangesAsync(); TempData["SuccessText"] = $"Dokument: {Tifo.Title} skapades Ok!"; return(RedirectToPage("./Index")); } TempData["FailText"] = $"Något gick fel vid skapandet av dokumentet. Försök igen"; } TempData["FailText"] = $"Något gick fel vid skapandet av dokumentet. Försök igen"; return(RedirectToPage("./Index")); }