Ejemplo n.º 1
0
        public async Task CreateAsync(NewJumpStartModel model)
        {
            var jumpStart = Map(new NewJumpStart(), model);

            jumpStart.Status = NewJumpStartStatus.Preview;

            _dbContext.NewJumpStarts.Add(jumpStart);
            await _dbContext.SaveChangesAsync();
        }
Ejemplo n.º 2
0
        private NewJumpStart Map(NewJumpStart newJumpStart, NewJumpStartModel model)
        {
            newJumpStart.DateTime           = model.DateTime !.Value;
            newJumpStart.Subject            = model.Subject;
            newJumpStart.DistributionGroups = model.DistributionGroups;
            newJumpStart.Tags   = model.Tags;
            newJumpStart.Body   = model.Body;
            newJumpStart.PdfUrl = model.PdfUrl;

            return(newJumpStart);
        }
Ejemplo n.º 3
0
        public async Task EditAsync(int id, NewJumpStartModel model)
        {
            var newJumpStart = await _dbContext.NewJumpStarts.FirstOrDefaultAsync(item => item.Id == id);

            if (newJumpStart is null)
            {
                throw new RecordNotFoundException($"NewJumpStart {id} not found");
            }

            newJumpStart = Map(newJumpStart, model);

            _dbContext.NewJumpStarts.Update(newJumpStart);
            await _dbContext.SaveChangesAsync();
        }
        public async Task <ActionResult <NewJumpStartResult> > Edit(int id, NewJumpStartModel model)
        {
            await _newJumpStartService.EditAsync(id, model);

            return(NoContent());
        }
        public async Task <CreateResult> Create(NewJumpStartModel model)
        {
            await _newJumpStartService.CreateAsync(model);

            return(Created());
        }