private void ShowHistoryCommandExecuted(EventUpdateModel update) { RaisePropertyChanged("DisableParentWindow"); var window = new UpdatesHistoryView(update.UpdatesHistory); window.ShowDialog(); RaisePropertyChanged("EnableParentWindow"); }
public void Update(int id, EventUpdateModel updateModel) { var eventFromDb = eventRepository.GetOne(id, updateModel.OccurenceId); mapper.Map(updateModel, eventFromDb); eventRepository.Save(eventFromDb); eventRepository.Commit(); // schedulerService.Schedule(mapper.Map<EventResource>(updateModel)); }
public async Task <Event> UpdateEvent(int id, EventUpdateModel model) { var dbEvent = await _dbContext.Events.FirstOrDefaultAsync(x => x.Id == id); //dbEvent.PeopleNeeded = model.PeopleNeeded; dbEvent.EventStatus = (int)model.EventStatus; dbEvent.UpdatedOn = DateTime.UtcNow; await _dbContext.SaveChangesAsync(); return(dbEvent); }
public static Event ToModel (this EventUpdateModel viewModel) { return new Event { Id = viewModel.Id, Name = viewModel.Name, ImgUrl = viewModel.ImgUrl, Location = viewModel.Location, Date = viewModel.Date, OrganizedBy = viewModel.OrganizedBy, Description = viewModel.Description, EventTypeId = viewModel.EventTypeId, }; }
public Guid?CreateOccurence(int id, EventUpdateModel model) { var eventFromDb = eventRepository.GetOne(id, model.OccurenceId); mapper.Map(model, eventFromDb); // Create new occurence of event. eventFromDb.Id = 0; eventFromDb.OccurenceId = Guid.NewGuid(); eventFromDb.ParentEvent = eventFromDb; eventRepository.Add(eventFromDb); eventRepository.Commit(); return(eventFromDb.OccurenceId); }
public OperationResult Update(int id, [FromBody] EventUpdateModel model) { int[] test = { 1, 2, 3 }; var list = test as IList <int>; Guid?occurenceId = null; if (model.EditSingleEvent) { occurenceId = eventService.CreateOccurence(id, model); } else { eventService.Update(id, model); } return(OperationResult.CreateOkResult(occurenceId)); }
public ResultModel Admin_EventUpdate(EventUpdateModel model) { if (!string.IsNullOrEmpty(model.Name) && !string.IsNullOrEmpty(model.City) && !string.IsNullOrEmpty(model.StartDate.ToString()) && !string.IsNullOrEmpty(model.Description)) { return(eventDal.Admin_EventUpdate(model)); } else { return(new ResultModel() { IsSuccess = false, Message = "Do not leave empty spaces" }); } }
public IActionResult Update(int id, [FromBody] EventUpdateModel model) { var callingUserId = HttpContext.User.Claims .FirstOrDefault(x => x.Type == ClaimTypes.Name) ?.Value; var @event = _mapper.Map <Event>(model); @event.Id = id; try { // update user _eventService.Update(@event); return(Ok()); } catch (AppException ex) { return(BadRequest(new { message = ex.Message })); } }
protected void Save_Click(object sender, EventArgs e) { model = new EventUpdateModel() { Id = Id, Name = eventName.Value, City = city.Value, StartDate = DateTime.Parse(startDate.Value), Description = description.Value }; var result = eventBal.Admin_EventUpdate(model); if (result.IsSuccess == true) { Page.ClientScript.RegisterStartupScript(GetType(), "Scripts", "<script>alert('" + result.Message + "');</script>"); Response.Redirect("/Views/AdminView/AdminEventView.aspx"); } }
private void ProcessNotesUpdates() { var updatesgroups = _allEventUpdates.Where(x => x.Field == "Notes").OrderByDescending(x => x.Date).GroupBy(x => x.ItemId); foreach (var updatesgroup in updatesgroups) { var updateHiistList = updatesgroup.Select(eventUpdate => new UpdatesHistoryModel() { EventUpdate = eventUpdate }).ToList(); var updateModel = new EventUpdateModel(updatesgroup.FirstOrDefault()); if (updateModel.EventUpdate != null) { updateModel.UpdatesHistory = updateHiistList.OrderBy(eventUpdate => eventUpdate.EventUpdate.Date).ToList(); AllEventUpdates.Add(updateModel); } } AllEventUpdates = new ObservableCollection <EventUpdateModel>(AllEventUpdates.OrderByDescending(eventUpdate => eventUpdate.EventUpdate.Date)); }
public async Task <IActionResult> UpdateEventById(int id, [FromBody] EventUpdateModel model) { if (ModelState.IsValid) { var updatedEvent = await _eventService.UpdateEvent(id, model); if (updatedEvent != null) { return(this.Ok(updatedEvent)); } else { return(this.BadRequest("Invalid ID")); } } else { return(this.BadRequest()); } }
public IActionResult Update(EventUpdateModel even) { if (ModelState.IsValid) { try { _service.Update(even.ToModel()); return(RedirectToAction("ManageEvents", new { UpdateMEssage = "Event updated sucessfully" })); } catch (NotFoundException ex) { return(RedirectToAction("ManageEvents", new { ErrorMessage = ex.Message })); } catch (Exception) { return(RedirectToAction("InternalError", "Info")); } } else { return(RedirectToAction("InternalError", "Info")); } }
public ResultModel Admin_EventUpdate(EventUpdateModel model) { ResultModel result = new ResultModel(); sqlCommand = new SqlCommand() { Connection = connectionHelper.connection, CommandType = CommandType.StoredProcedure, CommandText = "Admin_EventUpdateSP", }; sqlCommand.Parameters.Add("@EventId", SqlDbType.Int).Value = model.Id; sqlCommand.Parameters.Add("@Name", SqlDbType.NVarChar).Value = model.Name; sqlCommand.Parameters.Add("@City", SqlDbType.NVarChar).Value = model.City; sqlCommand.Parameters.Add("@StartDate", SqlDbType.DateTime).Value = model.StartDate; sqlCommand.Parameters.Add("@Description", SqlDbType.NVarChar).Value = model.Description; connectionHelper.connection.Open(); SqlDataReader sqlReader = sqlCommand.ExecuteReader(); if (sqlReader.HasRows) { if (sqlReader.Read()) { result = new ResultModel() { IsSuccess = (bool)sqlReader["IsSuccess"], Message = sqlReader["Message"] as string }; } } connectionHelper.connection.Close(); return(result); }