示例#1
0
        public void CreateOrder(Orders order)
        {
            if (order == null)
            {
                throw new Exception("Incomplete Fields");
            }

            _RTSystemContext.Orders.Add(order);
            _RTSystemContext.SaveChanges();
        }
示例#2
0
 public void CreateSellerBid(SellerBids sellerBid)
 {
     if (sellerBid == null)
     {
         throw new Exception("Incomplete Fields");
     }
     else
     {
         _RTSystemContext.SellerBids.Add(sellerBid);
         _RTSystemContext.SaveChanges();
     }
 }
示例#3
0
 public void CreateBuyerBid(BuyerBids buyerBid)
 {
     if (buyerBid.Quality == null || buyerBid.PaymentIn == null)
     {
         throw new Exception("Incomplete Fields");
     }
     else
     {
         _RTSystemContext.BuyerBids.Add(buyerBid);
         _RTSystemContext.SaveChanges();
     }
 }
示例#4
0
        public Users Authenticate(AuthenticateModel user)
        {
            var userExists = _RTSystemContext.Users
                             .SingleOrDefault(u => u.Email == user.email);

            if (userExists == null || !VerifyPassword(userExists.Password, user.password))
            {
                throw new Exception("Incorrect Email or Password");
            }
            if (userExists.Status == "deactivated")
            {
                userExists.Status = "active";
            }

            _RTSystemContext.SaveChanges();

            return(userExists);
        }