Пример #1
0
        public IActionResult RequestRide([FromBody] RideRquestModel model)
        {
            if (model == null)
            {
                return(BadRequest("invalid object"));
            }
            string          email  = User.FindFirst(ClaimTypes.NameIdentifier)?.Value;
            ApplicationUser user   = context.ApplicationUsers.FirstOrDefault(c => c.Email.Equals(email));
            string          result = IRiderService.RequestRide(user, model);

            if (result == "Ok")
            {
                return(Ok(new
                {
                    status = 200,
                    message = "Ride Requested Successfully."
                }));
            }
            return(BadRequest(new
            {
                error = result
            }));
        }