public async Task <IActionResult> Create([Bind("AchievementId,AchievementName,Description,NumberOfActions,TypeOfAction")] AchievementResponse achievementModel, [FromForm(Name = "file")] IFormFile file) { if (ModelState.IsValid) { await _achievementService.Create(achievementModel, file); return(RedirectToAction(nameof(Index))); } return(View(achievementModel)); }
public async Task <IActionResult> Create([FromBody] CreateAchievementModel model) { return(await ProcessAsync(async() => { var user = await UserService.GetUserByPrincipal(User); var request = new AchievementModel(model, user.Id); await _achievementService.Create(request); return Ok("Achievement created."); }, Permissions.Behaviour.Achievements.EditAchievements)); }