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);
        }
        public BaseResponse AddUser(UserRequest user)
        {
            BaseResponse resp = new BaseResponse();

            try
            {
                if (ValidateRequest.AddUser(user))
                {
                    var userCrud = new UserCRUD();

                    if (!userCrud.IsUserExists(user.User.PhoneNumber, user.User.Email) && !userCrud.IsUserExists(user.User.Id))
                    {
                        user.User.Id = 0;
                        new UserCRUD().AddUser(user.User);
                        if (user.User.Id > 0)
                        {
                            resp.OK();
                        }
                        else
                        {
                            resp.Conflict();
                        }
                    }
                    else
                    {
                        resp.Conflict();
                    }
                }
                else
                {
                    resp.BadRequest();
                }
            }
            catch (Exception es)
            {
                string req = JsonConvert.SerializeObject(user);
                logger.Error(string.Format("AddUser, Req={0}", req));
                logger.Error("AddUser " + es.StackTrace);
                resp.InternalServerError();
            }
            return(resp);
        }