コード例 #1
0
        private void AddFlows()
        {
            var cVs       = _context.CVs.ToArray();
            var vacancies = _context.Vacancies.ToArray();

            VacancyCVFlow[] flows = new VacancyCVFlow[]
            {
                new VacancyCVFlow()
                {
                    Id     = new Guid("342f6c46-9bd1-4508-b1f7-6a8eed1ac270"),
                    CVId   = cVs[0].Id, VacancyId = vacancies[0].Id,
                    Status = VacancyCVStatus.Draft
                },
                new VacancyCVFlow()
                {
                    Id     = new Guid("8c3978e9-bb20-4170-8a7e-20ae97250da3"),
                    CVId   = cVs[1].Id, VacancyId = vacancies[0].Id,
                    Status = VacancyCVStatus.CVPreparation,
                    Files  = new HashSet <VacancyCVFile>()
                    {
                        new VacancyCVFile()
                        {
                            Name = "DraftCV", Path = @"\\pathtofile"
                        },
                        new VacancyCVFile()
                        {
                            Name = "DraftCV2", Path = @"\\pathtofile2"
                        }
                    }
                },
                new VacancyCVFlow()
                {
                    Id     = new Guid("fe9098da-3258-4aac-96dd-88b0b65e2805"),
                    CVId   = cVs[2].Id, VacancyId = vacancies[0].Id,
                    Status = VacancyCVStatus.Cancelled
                },
                new VacancyCVFlow()
                {
                    Id     = new Guid("2888146e-e198-4fa4-bcc5-c6b488b3d812"),
                    CVId   = cVs[3].Id, VacancyId = vacancies[0].Id,
                    Status = VacancyCVStatus.CVReadyForClient
                },
                new VacancyCVFlow()
                {
                    Id     = new Guid("ad85fc0a-7f11-4d8f-9b3a-2b655658aaaf"),
                    CVId   = cVs[0].Id, VacancyId = vacancies[1].Id,
                    Status = VacancyCVStatus.Draft
                },
                new VacancyCVFlow()
                {
                    Id     = new Guid("0fecd44f-a898-4c12-b768-b5c6986429ee"),
                    CVId   = cVs[4].Id, VacancyId = vacancies[1].Id,
                    Status = VacancyCVStatus.Draft
                }
            };

            _context.VacancyCVFlows.AddRange(flows);
            _context.SaveChanges();
        }
コード例 #2
0
        public async Task <IActionResult> PostAsync([FromBody] VacancyCVFlowCreationRequestModel vacancyCVFlow)
        {
            if (vacancyCVFlow == null)
            {
                return(BadRequest());
            }

            VacancyCVFlowCreationServiceModel flow = _mapper.Map <VacancyCVFlowCreationRequestModel, VacancyCVFlowCreationServiceModel>(vacancyCVFlow);
            VacancyCVFlow addedFlow = await _vacancyCVFlowService.AddAsync(flow);

            return(CreatedAtRoute("GetVacancyCVFlow", new { id = addedFlow.Id }, addedFlow));
        }
コード例 #3
0
        public async Task <IActionResult> Get(Guid id)
        {
            VacancyCVFlow vacancyCVFlow = await _vacancyCVFlowService.GetByIdAsync(id);

            if (vacancyCVFlow != null)
            {
                return(Ok(vacancyCVFlow));
            }
            else
            {
                return(NotFound());
            }
        }
コード例 #4
0
        public async Task <IActionResult> Delete(Guid id)
        {
            VacancyCVFlow item = await _vacancyCVFlowService.GetByIdAsync(id);

            if (item == null)
            {
                return(NotFound());
            }

            await _vacancyCVFlowService.RemoveAsync(id);

            return(NoContent());
        }
コード例 #5
0
        public async Task <IActionResult> PutAsync(Guid id, [FromBody] VacancyCVFlow value)
        {
            VacancyCVFlow item = await _vacancyCVFlowService.GetByIdAsync(id);

            if (item == null)
            {
                return(NotFound());
            }

            if (value == null)
            {
                return(BadRequest());
            }

            value.Id = id;
            await _vacancyCVFlowService.UpdateAsync(value);

            return(Ok());
        }