Ejemplo n.º 1
0
        public async Task <IActionResult> AddInterview([FromBody] InterviewsResource InterviewResource)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var InterviewToAdd = _mapper.Map <InterviewsResource, Interviews>(InterviewResource);

            _repo.AddInterview(InterviewToAdd);
            await _unitofwork.CompleteAsync();

            return(StatusCode(201));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> UpdateInterview(int id, [FromBody] InterviewsResource interviewResource)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            Interviews interview = await _repo.Get(id);

            if (interview == null)
            {
                return(NotFound());
            }
            _mapper.Map <InterviewsResource, Interviews>(interviewResource, interview);
            await _unitofwork.CompleteAsync();

            return(StatusCode(202));
        }