public async Task <ActionResult> CreateAchievement(AchievementCreateDTO Achievement, CancellationToken Cancel)
        {
            try
            {
                await AchievementService.CreateAchievement(Achievement, Cancel);

                return(Ok());
            }
            catch
            {
                return(BadRequest());
            }
        }
Пример #2
0
        public IActionResult Create(CreateAchievementDto dto)
        {
            if (!this.ModelState.IsValid)
                return this.View(dto);

            dto.CreatorUsername = this.User.Identity.Name;

            try
            {
                var entity = _achievementService.CreateAchievement(dto);
            }
            catch (InvalidOperationException ex)
            {
                return this.BadRequest(ex.Message);
            }


            return Redirect("/Administration/Index");
        }