public static EventModel ToEventModel(this Event newEvent, string eventId) { EventModel dbEvent = new EventModel { InfernoEventId = eventId, MSGraphEventId = newEvent.Id, OrganizerEmail = newEvent.Organizer.EmailAddress.Address, OrganizerName = newEvent.Organizer.EmailAddress.Name, Subject = newEvent.Subject, Body = newEvent.Body.Content, StartTZ = newEvent.Start.DateTime, EndTZ = newEvent.End.DateTime, TimeZone = newEvent.Start.TimeZone, Start = newEvent.Start.ToDateTime(), End = newEvent.End.ToDateTime(), OriginalStart = newEvent.Start.ToDateTime(), OriginalStartTimeZone = newEvent.Start.TimeZone, CreatedDate = DateTime.UtcNow }; dbEvent.Attendees = new List <AttendeeModel>(); foreach (var item in newEvent.Attendees) { AttendeeModel attendee = new AttendeeModel { DisplayName = item.EmailAddress.Name, Mail = item.EmailAddress.Address }; dbEvent.Attendees.Add(attendee); } return(dbEvent); }
public async Task <int> Add(AttendeeModel attendee) { var entity = EntityModelAdapter.FromAttendeeModelToAttendee(attendee); _dbContext.Attendees.Add(entity); return(await _dbContext.SaveChangesAsync()); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Email,Title,Department")] AttendeeModel attendeeModel) { if (id != attendeeModel.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(attendeeModel); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AttendeeModelExists(attendeeModel.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(attendeeModel)); }
public Task <int> Add(AttendeeModel attendee) { var entity = Attendee.FromModel(attendee); dbContext.Attendees.Add(entity); return(dbContext.SaveChangesAsync()); }
public async Task <AttendeeModel> AddAttendee(AttendeeModel attendee) { var response = await _client.PostAsJsonAsync("/api/Attendee/Add", attendee); return(await response.ReadContentAs <AttendeeModel>());; }
public ActionResult DeleteConfirmed(Guid id) { AttendeeModel attendeeModel = db.Attendees.Find(id); db.Attendees.Remove(attendeeModel); db.SaveChanges(); return(RedirectToAction("Index")); }
public async Task <AttendeeModel> AddAttendeeTaskAsync(AttendeeModel newAttendee) { EntityEntry <AttendeeModel> att = await _context.Attendees.AddAsync(newAttendee); await _context.SaveChangesAsync(); return(att.Entity); }
public static Attendee FromAttendeeModelToAttendee(AttendeeModel attendeeModel) { return(new Attendee { ConferenceId = attendeeModel.ConferenceId, Name = attendeeModel.Name }); }
public static Attendee FromModel(AttendeeModel model) { return(new Attendee { ConferenceId = model.ConferenceId, Name = model.Name }); }
// POST api/<controller> public void Post([FromBody] AttendeeModel value) { if (ModelState.IsValid) { this.db.Attendees.Add(value); this.db.SaveChanges(); } }
public async Task DeleteAttendee(AttendeeModel attendeeModel) { await Initialize(); await _attendee.DeleteAsync(attendeeModel); await SyncAttendees(); }
public async Task <IActionResult> Add(int conferenceId, string name) { AttendeeModel attendee = await this._service.Add(new AttendeeModel() { Name = name, ConferenceId = conferenceId }).ConfigureAwait(false); return(new CreatedAtActionResult("Get", "Attendee", new { attendeeId = attendee.Id }, attendee)); }
public async Task <AttendeeVO> JoinAtSessionTaskAsync(AttendeeVO newAttendee) { AttendeeModel newAttendeeModel = _attendeeConverter.Parse(newAttendee); if (!(await _attendeeRepository.AddAttendeeTaskAsync(newAttendeeModel) is AttendeeModel addedAttendeeModel)) { throw new Exception("Nao foi possivel adicionar o participante na sessao"); } return(_attendeeConverter.Parse(addedAttendeeModel)); }
public async Task <AttendeeModel> GetById(int attendeeId) { AttendeeModel result = null; var response = await client.GetAsync($"/Attendee/GetById/{attendeeId}"); if (response.IsSuccessStatusCode) { result = await response.Content.ReadAsAsync <AttendeeModel>(); } return(result); }
public async Task <AttendeeModel> Add(AttendeeModel attendee) { AttendeeModel result = null; var response = await client.PostAsJsonAsync("/Attendee/Add", attendee); if (response.IsSuccessStatusCode) { result = await response.Content.ReadAsAsync <AttendeeModel>(); } return(result); }
public async Task LeaveAtSessionAsync(AttendeeVO attendee) { AttendeeModel attendeeModel = _attendeeConverter.Parse(attendee); if (!(await _attendeeRepository.FindByIdInSessionTaskAsync(attendeeModel) is AttendeeModel currentAttendee)) { throw new Exception("Nao foi possivel pegar as informaçoes do participante"); } await _attendeeRepository.LeaveAttendeeTaskAsync(currentAttendee); }
public async Task <IActionResult> Create([Bind("Id,Name,Email,Title,Department")] AttendeeModel attendeeModel) { if (ModelState.IsValid) { _context.Add(attendeeModel); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(attendeeModel)); }
public ActionResult Create([Bind(Include = "Id,Name,Email,Mealtime")] AttendeeModel attendeeModel) { if (ModelState.IsValid) { attendeeModel.Id = Guid.NewGuid(); db.Attendees.Add(attendeeModel); db.SaveChanges(); return(RedirectToAction("Index", "Home")); } return(View(attendeeModel)); }
public async Task <AttendeeModel> Add(AttendeeModel attendee) { AttendeeModel result = null; client.SetBearerToken(await httpContextAccessor.HttpContext.GetTokenAsync("access_token")); var response = await client.PostAsJsonAsync("/Attendee/Add", attendee); if (response.IsSuccessStatusCode) { result = await response.Content.ReadAsAsync <AttendeeModel>(); } return(result); }
public async Task <AttendeeModel> Add(AttendeeModel attendee) { return(await Task <AttendeeModel> .Run(() => { if (attendee == null || this._attendees == null) { return null; } attendee.Id = this._attendees.Count + 1; return attendee; }).ConfigureAwait(false)); }
public async Task <AttendeeModel> GetById(int attendeeId) { AttendeeModel result = null; client.SetBearerToken(await httpContextAccessor.HttpContext.GetTokenAsync("access_token")); var response = await client.GetAsync($"/Attendee/GetById/{attendeeId}"); if (response.IsSuccessStatusCode) { result = await response.Content.ReadAsAsync <AttendeeModel>(); } return(result); }
public async Task SaveAttendee(AttendeeModel attendeeModel) { await Initialize(); if (string.IsNullOrEmpty(attendeeModel.Id)) { await _attendee.InsertAsync(attendeeModel); } else { await _attendee.UpdateAsync(attendeeModel); } await SyncAttendees(); }
public IActionResult Register(AttendeeModel obj) { if (!ModelState.IsValid) { return(View(obj)); } //var options = SaveOptions.PdfDefault; var options = new PdfSaveOptions() { ImageDpi = 220 }; DocumentModel document = Download(obj.FirstName, obj.LastName); //Save document to DOCX format in byte array. using (var stream = new MemoryStream()) { document.Save(stream, options); return(File(stream.ToArray(), "application/pdf", obj.FirstName + "_" + obj.LastName + "_invite.pdf")); } }
public async Task <ActionResult> AddAttendee(AttendeeModel item) { try { if (ModelState.IsValid) { HttpClient client = new HttpClient(); client.BaseAddress = new Uri(App_Start.ApplicationConfig.AttendeeServiceUri); client.DefaultRequestHeaders.Accept.Add( new MediaTypeWithQualityHeaderValue("application/json")); Console.WriteLine(client.BaseAddress); var response = await client.PostAsJsonAsync("/api/Attendee", item); response.EnsureSuccessStatusCode(); } } catch (Exception ex) { Console.WriteLine(ex.Message); } return(RedirectToAction("Services", "Home")); }
public async Task <IActionResult> BeforeAndAfter(string id) { if (string.IsNullOrEmpty(id)) { id = "999"; } DemoModel model = new DemoModel() { Id = id }; model.Attendees = new List <AttendeeModel>(); StorageHelper <DynamicTableEntity> helper = new StorageHelper <DynamicTableEntity>(_config); List <DynamicTableEntity> attendees = await helper.Get <DynamicTableEntity>(id, "importdata"); foreach (DynamicTableEntity entity in attendees) { AttendeeModel am = new AttendeeModel(); am.Name = entity.GetValue("member_name").ToString(); am.BeforeImage = entity.GetValue("meetup_image").ToString(); if (entity.GetValue("thumbnailimageurl") != null) { am.AfterImageThumbnail = entity.GetValue("thumbnailimageurl").ToString(); am.AfterImage = entity.GetValue("contentimageurl").ToString(); } else { am.AfterImage = "https://image.flaticon.com/icons/png/512/55/55089.png"; am.AfterImageThumbnail = "https://image.flaticon.com/icons/png/512/55/55089.png"; } model.Attendees.Add(am); } return(View(model)); }
public async Task <IHttpActionResult> Post(AttendeeModel model) { try { if (ModelState.IsValid) { var attdendee = _mapper.Map <Attendee>(model); _repository.AddAttendee(attdendee); if (await _repository.SaveChangesAsync()) { var newModel = _mapper.Map <AttendeeModel>(attdendee); return(Ok(newModel)); } } return(BadRequest(ModelState)); } catch (Exception ex) { return(InternalServerError(ex)); } }
public async Task SaveAttendee(AttendeeModel attendeeModel) { }
public async Task GotoDetails(AttendeeModel attendeeModel) { await GetMainPage().PushAsync(new DetailsView(attendeeModel)); }
public AttendeeModel Add(AttendeeModel attendee) { attendee.Id = attendees.Max(a => a.Id) + 1; attendees.Add(attendee); return(attendee); }
public async Task DeleteAttendee(AttendeeModel attendeeModel) { }