public async Task <IActionResult> AddTechnologies([FromBody] Technologies entity) { await _context.AddAsync(entity); await _context.SaveChangesAsync(); var newCreatedTech = _context.Technologies.FirstOrDefaultAsync(c => c.Id == entity.Id); return(Created("GetTechnologies", new { Id = newCreatedTech.Id })); }
public async Task <Campaign> InsertCampaignAsync(Campaign Campaign) { Campaign.CampaignId = Guid.NewGuid(); await _ctx.AddAsync(Campaign); try { await _ctx.SaveChangesAsync(); } catch (System.Exception ex) { throw new Exception($"{ex.Message}"); } return(Campaign); }
public async Task <Training> InsertTrainingAsync(Training Training) { Training.TrainingId = Guid.NewGuid(); await _ctx.AddAsync(Training); try { await _ctx.SaveChangesAsync(); } catch (Exception ex) { throw new Exception($"{ex.Message}"); } return(Training); }
public async Task <Contact> InsertContactAsync(Contact Contact) { Contact.ContactId = Guid.NewGuid(); await _context.AddAsync(Contact); try { await _context.SaveChangesAsync(); } catch (Exception ex) { _loggerFactory.LogInformation($"{ex.Message}"); } return(Contact); }
public async Task <IActionResult> Post([FromBody] NewTraining entity) { // if (entity.TechnologyId) { // } await _context.AddAsync(entity); await _context.SaveChangesAsync(); var newTraining = _context.NewTrainings.FirstOrDefaultAsync(x => x.Id == entity.Id); return(Created("GetNewTrainings", new { Id = newTraining.Id })); }