public IHttpActionResult Post(FormData note) { IHttpActionResult result = ValidateAdminRequest(); if (result != null) { return(result); } try { using (AdoDataConnection connection = new AdoDataConnection(SettingsCategory)) { EventNote record = new EventNote() { EventID = note.EventID, Note = note.Note, UserAccount = User.Identity.Name, Timestamp = DateTime.Now }; new TableOperations <EventNote>(connection).AddNewRecord(record); result = Ok(record); } } catch (Exception ex) { result = InternalServerError(ex); } return(result); }
private void CancelCommandExecuted() { _eventsDataUnit.RevertChanges(); if (_isEditMode) { EventNote.Refresh(); } }
public EventNote Save(EventNote domain) { using (var adapter = PersistenceLayer.GetDataAccessAdapter()) { var entity = Mapper.Map <EventNote, EventNoteEntity>(domain); if (!adapter.SaveEntity(entity, true)) { throw new PersistenceFailureException(); } return(Mapper.Map <EventNoteEntity, EventNote>(entity)); } }
public async Task <EventNote> UpdateEventNote(EventNote eventNote) { keepNoteDbContext.Entry(eventNote).State = EntityState.Modified; try { await keepNoteDbContext.SaveChangesAsync(); } catch (DbUpdateException ex) { logger.LogError("Unable to add a new event note " + ex.Message); } return(eventNote); }
public async Task <EventNote> AddEventNote(EventNote eventNote) { try { keepNoteDbContext.EventNotes.Add(eventNote); await keepNoteDbContext.SaveChangesAsync(); } catch (DbUpdateException ex) { logger.LogError("Unable to add a new event note " + ex.Message); } return(eventNote); }
public async Task <IActionResult> PutEventNote(long id, EventNote eventNote) { if (id != eventNote.Id) { return(BadRequest()); } eventNote = await eventNoteService.UpdateEventNote(eventNote); if (eventNote == null) { return(NotFound()); } return(NoContent()); }
public IHttpActionResult AddMultiNote(FormDataMultiNote note) { IHttpActionResult result = ValidateAdminRequest(); if (result != null) { return(result); } try { using (AdoDataConnection connection = new AdoDataConnection("systemSettings")) { DateTime now = DateTime.Now; List <EventNote> records = new List <EventNote>(); foreach (int eventId in note.EventIDs) { EventNote record = new EventNote() { EventID = eventId, Note = note.Note, UserAccount = User.Identity.Name, Timestamp = now }; new TableOperations <EventNote>(connection).AddNewRecord(record); records.Add(record); } result = Ok(records); } } catch (Exception ex) { result = InternalServerError(ex); } return(result); }
public EventNoteModel(EventNote eventNote) { _eventNote = eventNote; }
public EventPacketNotify() { EventList = null; }
public async Task <ActionResult <EventNote> > PostEventNote(EventNote eventNote) { eventNote = await eventNoteService.AddEventNote(eventNote); return(Ok(eventNote)); }
public void Update(EventNote EventNote) { _EventNoteRepository.Update(EventNote); }
public EventNote Add(EventNote EventNote) { return(_EventNoteRepository.Add(EventNote)); }
public AddNotesListModel Create(IEnumerable <EventBasicInfoViewModel> events, EventNote eventNote, IEnumerable <EventNotesLog> eventNotesLogs, IEnumerable <OrderedPair <long, string> > eventIdCorporateAccountNamePairs) { var collection = new List <AddNotesViewModel>(); foreach (var theEvent in events) { var eventIdCorporateAccountNamePair = eventIdCorporateAccountNamePairs.FirstOrDefault(x => x.FirstValue == theEvent.Id); var eventNotesLog = eventNotesLogs != null?eventNotesLogs.FirstOrDefault(x => x.EventId == theEvent.Id) : null; collection.Add(new AddNotesViewModel { EventId = theEvent.Id, EventDate = theEvent.EventDate, HostName = theEvent.HostName, Pods = theEvent.Pods.Select(x => x.SecondValue), HealthPlan = eventIdCorporateAccountNamePair != null ? eventIdCorporateAccountNamePair.SecondValue : "N/A", IsSelected = eventNotesLog != null, }); } var model = new AddNotesListModel { Collection = collection, TotalRecords = collection.Count, AllSelected = collection.All(x => x.IsSelected), IsPublish = eventNote != null && eventNote.IsPublished, Note = eventNote != null ? eventNote.Note : string.Empty }; return(model); }