Exemple #1
0
        public async Task <IActionResult> UpdateField([FromRoute] int cvId, [FromRoute] int sectionId, [FromRoute] int fieldId, [FromBody] CVFieldDataset updateField)
        {
            CVSectionDataset section = await _cvService.GetCVSection(cvId, sectionId);

            CVFieldDataset field = await _cvService.GetSectionField(sectionId, fieldId);

            if (section == null && field == null)
            {
                return(NotFound());
            }
            if (await _cvService.UpdateField(updateField))
            {
                return(NoContent());
            }
            return(BadRequest());
        }
Exemple #2
0
        public async Task <IActionResult> CreateSection([FromRoute] int cvId, [FromBody] NewSectionParam section)
        {
            if (cvId != section.CVId)
            {
                return(Forbid());
            }
            try
            {
                CVSectionDataset result = await _cvService.CreateSection(section);

                if (result != null)
                {
                    return(Created("", result));
                }
            }
            catch (Exception ex)
            {
                if (ex.Message.Contains("confict"))
                {
                    return(Conflict());
                }
            }
            return(BadRequest());
        }