public BaseResponse UpdateUser(UserCR req)
        {
            BaseResponse resp = new BaseResponse();

            try
            {
                if (ValidateRequest.UpdateUser(req))
                {
                    UserCRUD userCRUD = new UserCRUD();
                    var      email    = JWTService.ValidateToken(req.Token);
                    if (!string.IsNullOrEmpty(email) && email == req.User.email_id)
                    {
                        req.User.last_update = DateTime.Now;
                        if (userCRUD.UpdateUser(req.User) > 0)
                        {
                            resp.StatusCode    = HttpStatusCode.OK;
                            resp.StatusMessage = HttpStatusCode.OK.ToString();
                        }
                        else
                        {
                            resp.StatusCode    = HttpStatusCode.Ambiguous;
                            resp.StatusMessage = HttpStatusCode.Ambiguous.ToString();
                        }
                    }
                    else
                    {
                        resp.StatusCode    = HttpStatusCode.Unauthorized;
                        resp.StatusMessage = HttpStatusCode.Unauthorized.ToString();
                    }
                }
                else
                {
                    resp.StatusCode    = HttpStatusCode.BadRequest;
                    resp.StatusMessage = HttpStatusCode.BadRequest.ToString();
                }
            }
            catch (Exception es)
            {
                resp.StatusCode    = HttpStatusCode.InternalServerError;
                resp.StatusMessage = HttpStatusCode.InternalServerError.ToString();
            }
            return(resp);
        }
        public BaseResponse AddUser(UserCR req)
        {
            BaseResponse resp = new BaseResponse();

            try
            {
                if (ValidateRequest.AddUser(req))
                {
                    UserCRUD userCRUD = new UserCRUD();
                    if (!userCRUD.IsUserEmailExists(req.User.email_id))
                    {
                        req.User.last_update = DateTime.Now;
                        if (userCRUD.AddUser(req.User) > 0)
                        {
                            resp.StatusCode    = HttpStatusCode.OK;
                            resp.StatusMessage = HttpStatusCode.OK.ToString();
                        }
                        else
                        {
                            resp.StatusCode    = HttpStatusCode.Ambiguous;
                            resp.StatusMessage = HttpStatusCode.Ambiguous.ToString();
                        }
                    }
                    else
                    {
                        resp.StatusCode    = HttpStatusCode.Conflict;
                        resp.StatusMessage = HttpStatusCode.Conflict.ToString();
                    }
                }
                else
                {
                    resp.StatusCode    = HttpStatusCode.BadRequest;
                    resp.StatusMessage = HttpStatusCode.BadRequest.ToString();
                }
            }
            catch (Exception es)
            {
                resp.StatusCode    = HttpStatusCode.InternalServerError;
                resp.StatusMessage = HttpStatusCode.InternalServerError.ToString();
            }
            return(resp);
        }