Beispiel #1
0
        public async Task <ActionResult <Walk> > PostWalk([FromHeader] string token, [FromHeader] string email, [FromBody] Walk walk)
        {
            // if user not authenticated
            if (!await _walkerRepository.Authenticated(token, email))
            {
                return(Unauthorized());
            }

            if (await _walkRepository.Exists(email))
            {
                return(Conflict());
            }

            Guid guid = Guid.NewGuid();

            walk.Id        = guid.ToString();
            walk.Status    = 0;
            walk.UserEmail = email;
            await _walkRepository.Add(walk);

            walk.WithoutWalkerInfo();
            return(Ok(walk));
        }