public IHttpActionResult PuttblProductCategory(int id, tblProductCategory tblProductCategory)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != tblProductCategory.recNo)
            {
                return(BadRequest());
            }

            db.Entry(tblProductCategory).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!tblProductCategoryExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
 public IHttpActionResult PutRoleDeleteName(tblUsersRole r)
 {
     r.status          = 1;
     db.Entry(r).State = EntityState.Modified;
     db.SaveChanges();
     return(Json("Done"));
 }
 public IHttpActionResult PutEmployeesDeleteName(tblEmployeesInfo r)
 {
     r.Status          = 1;
     db.Entry(r).State = EntityState.Modified;
     db.SaveChanges();
     return(Json("Done"));
 }
        public IHttpActionResult PutRemoveProduct(int id)
        {
            db.tblProducts.Where(a => a.recNo == id).ToList()
            .ForEach(b => b.Status = 3);
            db.SaveChanges();

            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemple #5
0
        public IHttpActionResult PostRegister(tblBiddersInfo bidders)
        {
            bidders.Status         = 0;
            bidders.BiddersId      = Guid.NewGuid().ToString("N").Substring(0, 5).ToUpper();
            bidders.ViolationCount = 0;

            db.Entry(bidders).State = EntityState.Added;
            db.SaveChanges();

            return(Json(bidders.BiddersId));
        }
Exemple #6
0
        public IHttpActionResult PostBidNow(string id, bidDetails b)
        {
            tblBidding bid = new tblBidding();

            bid.BiddersId   = b.userID;
            bid.AuctionId   = id;
            bid.BidPrice    = b.amount;
            bid.Status      = 0;
            bid.DateCreated = DateTime.Now;

            db.Entry(bid).State = System.Data.Entity.EntityState.Added;
            db.SaveChanges();

            return(Ok());
        }
Exemple #7
0
        public IHttpActionResult PutAuctionStatus(string id)
        {
            db.tblProducts.Where(a => a.ProductId == id).ToList()
            .ForEach(b => b.Status = 1);
            db.SaveChanges();

            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemple #8
0
        public IHttpActionResult PostAddCompany(Company comp)
        {
            //checking sa username
            var userExist = db.tblUserManagements.Where(u => u.UserName == comp.Username);

            if (userExist.Count() > 0)
            {
                return(BadRequest());
            }
            else
            {
                tblUserManagement user = new tblUserManagement();
                user.UserName    = comp.Username;
                user.Password    = comp.Password;
                user.RoleId      = "2";
                user.UsersId     = Guid.NewGuid().ToString("N").Substring(0, 5).ToUpper();
                user.DateCreated = DateTime.Now;
                user.Status      = 1;

                db.Entry(user).State = EntityState.Added;

                tblBranchShop branch = new tblBranchShop();
                branch.BranchName   = comp.BranchName;
                branch.EmailAddress = comp.EmailAddress;
                branch.Address      = comp.Address;
                branch.userID       = user.UsersId;
                branch.BranchId     = Guid.NewGuid().ToString("N").Substring(0, 5).ToUpper();

                db.Entry(branch).State = EntityState.Added;

                db.SaveChanges();

                return(Ok());
            }
        }
Exemple #9
0
        public IHttpActionResult PutsStatus(tblUserManagement tblUserManagement)
        {
            if (tblUserManagement.Status != 1)
            {
                tblUserManagement.Status = 1;
            }
            else
            {
                tblUserManagement.Status = 0;
            }

            tblUserManagement.UpdatedBy   = "UPDBY";
            tblUserManagement.DateUpdated = DateTime.Now;
            var switchery = db.Entry(tblUserManagement).State = EntityState.Modified;

            db.SaveChanges();
            return(Json("success"));
        }
        public IHttpActionResult PostSetWinner(string bID, string aID)
        {
            try
            {
                var data = db.tblAuctionItems.SingleOrDefault(a => a.AuctionId == aID);
                data.WinnerId = bID;

                tblNotification notif = new tblNotification();
                notif.biddersID       = bID;
                notif.auctionID       = aID;
                db.Entry(notif).State = EntityState.Added;


                db.SaveChanges();

                return(Ok());
            }
            catch (Exception)
            {
                return(BadRequest());
            }
        }