public async Task <IActionResult> Create([Bind("LeagueId,LeagueName,Logo,HashPassword,LeagueKey")] Leagues leagues) { if (ModelState.IsValid) { _context.Add(leagues); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(leagues)); }
public void Delete(int?[] id) { var entities = _entities.Where(f => id.Contains(f.Id)).ToList(); entities.ForEach(a => a.IsDeleted = true); _context.SaveChangesAsync(); }
public void DeleteBookShelfInLocation(int?[] locationId) { var entities = _entities.Where(f => locationId.Contains(f.LocationId)).ToList(); entities.ForEach(a => a.IsDeleted = true); _context.SaveChangesAsync(); }
public async Task <ActionResult> Update(Guid id, Registration registration) { Registration existingRegistration = await _context.Registrations.FindAsync(id); if (existingRegistration == null) { return(NotFound()); } existingRegistration.HasPhotoRelease = registration.HasPhotoRelease; existingRegistration.IsWaitList = registration.IsWaitList; _context.Registrations.Update(existingRegistration); await _context.SaveChangesAsync(); return(Ok()); }
public async Task <CreateRegistrationResult> HandleAsync(CreateRegistration request) { var dataModel = request.MapTo <Sogeti.Capstone.Data.Model.Registration>(); var response = Context.Registrations.Add(dataModel); await Context.SaveChangesAsync(); return(new CreateRegistrationResult { Id = response.Id }); }
public async Task <CreateEventResult> HandleAsync(CreateEvent request) { var dataModel = request.MapTo <Sogeti.Capstone.Data.Model.Event>(); var repsonse = Context.Events.Add(dataModel); await Context.SaveChangesAsync(); return(new CreateEventResult { Id = repsonse.Id }); }
public async Task <ActionResult> Delete(Guid id) { Event existingEvent = await _context.Events.FindAsync(id); if (existingEvent == null) { return(NotFound()); } string imagePath = Path.Combine( _hostingEnvironment.WebRootPath, "uploads", existingEvent.ImageId.ToString() ); _context.Events.Remove(existingEvent); await _context.SaveChangesAsync(); System.IO.Directory.Delete(imagePath, true); return(NoContent()); }
public async Task SaveChangesAsync() { await _context.SaveChangesAsync(); }
public void DeleteDrawerInBookShelf(int?[] bookShelfId) { var entities = _entities.Where(f => bookShelfId.Contains(f.BookShelfId)).ToList(); entities.ForEach(a => a.IsDeleted = true); _context.SaveChangesAsync(); }