public async Task <IActionResult> Edit(Guid id, [Bind("Id,VideoPath")] PromoVideos promoVideos) { if (id != promoVideos.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(promoVideos); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PromoVideosExists(promoVideos.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(promoVideos)); }
public async Task <IActionResult> PutPromoVideos(Guid id, PromoVideos promoVideos) { if (id != promoVideos.Id) { return(BadRequest()); } _context.Entry(promoVideos).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PromoVideosExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> Create([Bind("Id,VideoPath")] PromoVideos promoVideos) { if (ModelState.IsValid) { promoVideos.Id = Guid.NewGuid(); _context.Add(promoVideos); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(promoVideos)); }
public async Task <ActionResult <PromoVideos> > PostPromoVideos(PromoVideos promoVideos) { _context.PromoVideos.Add(promoVideos); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (PromoVideosExists(promoVideos.Id)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("GetPromoVideos", new { id = promoVideos.Id }, promoVideos)); }