Exemple #1
0
        public async Task<IActionResult> Edit(Guid id, [Bind("EventGolfId,Id,Feature")] EventGolfFeatures eventGolfFeatures)
        {
            if (id != eventGolfFeatures.EventGolfId)
            {
                return NotFound();
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(eventGolfFeatures);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EventGolfFeaturesExists(eventGolfFeatures.EventGolfId))
                    {
                        return NotFound();
                    }
                    else
                    {
                        throw;
                    }
                }
                return RedirectToAction("Index");
            }
            ViewData["EventGolfId"] = new SelectList(_context.EventGolf, "Id", "TypeOfEvent", eventGolfFeatures.EventGolfId);
            return View(eventGolfFeatures);
        }
Exemple #2
0
 public async Task<IActionResult> Create([Bind("EventGolfId,Id,Feature")] EventGolfFeatures eventGolfFeatures)
 {
     if (ModelState.IsValid)
     {
         eventGolfFeatures.EventGolfId = Guid.NewGuid();
         _context.Add(eventGolfFeatures);
         await _context.SaveChangesAsync();
         return RedirectToAction("Index");
     }
     ViewData["EventGolfId"] = new SelectList(_context.EventGolf, "Id", "TypeOfEvent", eventGolfFeatures.EventGolfId);
     return View(eventGolfFeatures);
 }