public async Task <IActionResult> Edit(int id, [Bind("Id,Year,Month,DayOfMonth,Time,NameOfEvent,NameOfHall")] ListOfEventsTheatrical listOfEventsTheatrical) { if (id != listOfEventsTheatrical.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(listOfEventsTheatrical); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ListOfEventsTheatricalExists(listOfEventsTheatrical.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(listOfEventsTheatrical)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,ListOfTheatricalId,Year,Month,DayOfMonth,Time,NameOfEvent,DictTheatricalHallId,CreateDate,ApplicationUserId")] ListOfEventsTheatrical listOfEventsTheatrical) { if (id != listOfEventsTheatrical.Id) { return(NotFound()); } if (ModelState.IsValid) { try { string uid = HttpContext.User.FindFirst(ClaimTypes.NameIdentifier).Value; listOfEventsTheatrical.ApplicationUserId = uid; _context.Update(listOfEventsTheatrical); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ListOfEventsTheatricalExists(listOfEventsTheatrical.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index), new { id = listOfEventsTheatrical.ListOfTheatricalId })); } ViewData["DictTheatricalHallId"] = new SelectList(_context.DictTheatricalHall, "Id", "NameRus", listOfEventsTheatrical.DictTheatricalHallId); ViewData["ListOfTheatricalId"] = new SelectList(_context.ListOfTheatrical, "Id", "NameRus", listOfEventsTheatrical.ListOfTheatricalId); return(View(listOfEventsTheatrical)); }
public async Task <IActionResult> Create([Bind("Id,Year,Month,DayOfMonth,Time,NameOfEvent,NameOfHall")] ListOfEventsTheatrical listOfEventsTheatrical) { if (ModelState.IsValid) { _context.Add(listOfEventsTheatrical); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(listOfEventsTheatrical)); }
public async Task <IActionResult> Create([Bind("Id,ListOfTheatricalId,Year,Month,DayOfMonth,Time,NameOfEvent,DictTheatricalHallId,CreateDate,ApplicationUserId")] ListOfEventsTheatrical listOfEventsTheatrical) { if (ModelState.IsValid) { _context.Add(listOfEventsTheatrical); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index), new { id = listOfEventsTheatrical.ListOfTheatricalId })); } ViewData["DictTheatricalHallId"] = new SelectList(_context.DictTheatricalHall, "Id", "NameRus", listOfEventsTheatrical.DictTheatricalHallId); ViewData["ListOfTheatricalId"] = new SelectList(_context.ListOfTheatrical, "Id", "NameRus", listOfEventsTheatrical.ListOfTheatricalId); return(View(listOfEventsTheatrical)); }
// GET: Theatrical/ListOfEventsTheatricals/Create public IActionResult Create() { string name = "0"; if (HttpContext.Request.Cookies.ContainsKey("ListTheatricalsId")) { name = HttpContext.Request.Cookies["ListTheatricalsId"]; } string uid = _httpContextAccessor.HttpContext.User.FindFirst(ClaimTypes.NameIdentifier).Value; ListOfEventsTheatrical model = new ListOfEventsTheatrical(); model.ListOfTheatricalId = int.Parse(name); model.CreateDate = DateTime.Now; model.ApplicationUserId = uid; ViewData["DictTheatricalHallId"] = new SelectList(_context.DictTheatricalHall, "Id", "NameRus"); ViewData["ListOfTheatricalId"] = new SelectList(_context.ListOfTheatrical, "Id", "NameRus"); return(View(model)); }