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 }));
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        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);
        }
Exemplo n.º 5
0
        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 }));
        }