예제 #1
0
        /// <summary>
        /// Deactivates a user by the specified id.
        /// </summary>
        /// <param name="id">The user id.</param>
        public virtual void Deactivate(Guid id)
        {
            var user = Persistor.Get(id);

            user.Active = false;
            Persistor.Save(user);
            Persistor.Commit();
        }
예제 #2
0
        public override bool Delete(Guid id)
        {
            if (id == Guid.Empty)
            {
                throw new ArgumentException("invoice id cannot be empty");
            }

            var invoice = Persistor.Get(id);

            // verify that the invoice dosen't have any payments
            // we can't delete invoices that have payments
            if (invoice.Payments != null && invoice.Payments.Count > 0)
            {
                throw new NotImplementedException("an invoice that contains a payment can not be deleted");
            }

            Persistor.Delete(id);
            return(Persistor.Commit() > 0);
        }
예제 #3
0
 public virtual IQueryable <Data.Model.UserService> GetList(
     System.Linq.Expressions.Expression <Func <Data.Model.UserService, bool> > predicate)
 {
     return(Persistor.Get(predicate));
 }
예제 #4
0
 /// <summary>
 /// Gets the by username.
 /// </summary>
 /// <param name="username">The username.</param>
 /// <returns></returns>
 public virtual Data.Model.User GetByUsername(string username)
 {
     return(Persistor.Get(u => u.UserName == username).FirstOrDefault());
 }