コード例 #1
0
        public virtual async Task <IActionResult> GetJobsForMe()
        {
            try
            {
                var userId         = UserManager.GetUserId(User);
                var swabJobMatches = await SwabJobMatchService.GetJobMatchesForUserAsync(userId);

                return(Ok(swabJobMatches));
            }
            catch (HttpStatusCodeException)
            {
                throw;
            }
            catch (Exception e)
            {
                throw new InternalServerErrorHttpException(e);
            }
        }
コード例 #2
0
        public async Task <IActionResult> Accept([FromBody] PrimitiveViewModel <int> jobId)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    var userId = UserManager.GetUserId(User);
                    await SwabJobMatchService.AcceptJobAsync(jobId.Data, userId);

                    return(Ok());
                }
                catch (HttpStatusCodeException)
                {
                    throw;
                }
                catch
                {
                    throw new InternalServerErrorHttpException("Interner Serverfehler beim Akzeptieren einer Bewerbung.");
                }
            }
            return(BadRequest(ModelState));
        }