Пример #1
0
        public ApiResponse FindByField(string field, string value)
        {
            AccountProcessor = new AccountProcessor();
            Response         = new ApiResponse();

            try
            {
                AccountProcessor.FindByField(field, value);
                Response.text   = JsonConverter.JsonConverter.ObjToJson(AccountProcessor.FindByField(field, value));
                Response.result = true;

                return(Response);
            }
            catch (Exception e)
            {
                Response.text   = "An account with this field or value doesn't exist" + e;
                Response.result = false;

                return(Response);
            }
        }
        private void ValidateParameters(string username, string email)
        {
            var existingUserName = UserProcessor
                                   .FindByField("username", username)
                                   .SingleOrDefault();

            var existingEmail = _accountProcessor
                                .FindByField("email", email)
                                .SingleOrDefault();

            switch (existingUserName != null, existingEmail != null)
            {