public bool UpdateEventRounds(int roundId, EventRounds eventRounds) { var currentEvent = dbContext.EventRounds.FirstOrDefault(e => e.Id == roundId); currentEvent.RoundName = eventRounds.RoundName; currentEvent.RoundDuration = eventRounds.RoundDuration; currentEvent.NoOfVideos = eventRounds.NoOfVideos; currentEvent.DaysDurations = eventRounds.DaysDurations; currentEvent.RoundOrderNo = eventRounds.RoundOrderNo; currentEvent.ImageName = eventRounds.ImageName; currentEvent.ShowVotes = eventRounds.ShowVotes; currentEvent.IsActive = true; currentEvent.StartDate = eventRounds.StartDate; currentEvent.EndDate = eventRounds.EndDate; currentEvent.EventType = eventRounds.EventType; currentEvent.IsbackStage = eventRounds.IsbackStage; currentEvent.EventStage = eventRounds.EventStage; return(dbContext.SaveChanges() > 0); }
public bool SaveEventRounds(EventRounds eventRounds) { dbContext.EventRounds.Add(new EventRounds { RoundName = eventRounds.RoundName, RoundDuration = eventRounds.RoundDuration, NoOfVideos = eventRounds.NoOfVideos, DaysDurations = eventRounds.DaysDurations, RoundOrderNo = eventRounds.RoundOrderNo, IsDeleted = false, ImageName = eventRounds.ImageName, ShowVotes = eventRounds.ShowVotes, IsActive = true, StartDate = eventRounds.StartDate, EndDate = eventRounds.EndDate, EventType = eventRounds.EventType, IsbackStage = eventRounds.IsbackStage, EventStage = eventRounds.EventStage, }); return(dbContext.SaveChanges() > 0); }
public async Task <ActionResult> Edit(int id, EventRounds round) { try { if (ModelState.IsValid) { var files = HttpContext.Request.Form.Files; foreach (var Image in files) { if (Image != null && Image.Length > 0) { var file = Image; //There is an error here var uploads = Path.Combine(_appEnvironment.WebRootPath, "Uploads\\EventImages"); if (file.Length > 0) { var fileName = Guid.NewGuid().ToString().Replace("-", "") + Path.GetExtension(file.FileName); using (var fileStream = new FileStream(Path.Combine(uploads, fileName), FileMode.Create)) { await file.CopyToAsync(fileStream); round.ImageName = fileName; } } } } _eventService.UpdateEventRounds(id, round); return(RedirectToAction(nameof(Index), new { id = round.EventType })); } } catch (Exception ex) { round.DeveloperMessage = ex.Message; } return(View(round)); }
public bool DeleteEventRounds(int roundId, EventRounds eventRounds) { throw new NotImplementedException(); }
public EventRoundsViewModel() { Round = new EventRounds(); Videos = new List <Video>(); }