Exemple #1
0
        public ClientsWithCount GetAll(int id, int offset, bool isCount = false)
        {
            ClientsWithCount response = new ClientsWithCount();

            try
            {
                response.Clients = _context.Clients.Where(p => p.ReturnTypeId == id).OrderBy(p => p.Id).Skip(offset).Take(10).ToList();
                if (isCount)
                {
                    response.TotalCount = _context.Clients.Count(p => p.ReturnTypeId == id);
                }
            }
            catch (System.Exception ex)
            {
                Log4Net.WriteException(ex);
                return(null);
            }
            return(response);
        }
Exemple #2
0
        public bool AutheticateUser(string username, string password)
        {
            bool isValid = false;

            try
            {
                if (!string.IsNullOrEmpty(username) && !string.IsNullOrEmpty(password))
                {
                    return(_context.Logins.Any(p => p.Username.ToLower() == username.ToLower() && p.Password == password));
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                Log4Net.WriteException(ex);
            }
            return(isValid);
        }