예제 #1
0
        public async Task <IActionResult> Create([FromForm] RankCreateModel createModel)
        {
            try
            {
                var isEffected = await _rankService.CreateAsync(createModel);

                return(RedirectToAction(nameof(Index)));
            }
            catch
            {
                return(View(createModel));
            }
        }
예제 #2
0
 public async Task <ActionResult <RankDTO> > CreateAsync([FromBody] RankCreateDTO model)
 {
     try
     {
         return(Ok(await rankService.CreateAsync(model)));
     }
     catch (ValidationException e)
     {
         return(BadRequest(e.ValidationErrors));
     }
     catch (NotFoundException e)
     {
         return(NotFound(new { Id = e.Key, e.Message }));
     }
 }