public IHttpActionResult PutEmployeesDeleteName(tblEmployeesInfo r) { r.Status = 1; db.Entry(r).State = EntityState.Modified; db.SaveChanges(); return(Json("Done")); }
public IHttpActionResult PutUpdateProduct(tblProduct tblproduct) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.Entry(tblproduct).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!tblProductExists(tblproduct.recNo)) { return(NotFound()); } else { throw; } } return(Json(tblproduct)); }
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()); } }
public IHttpActionResult PutRoleDeleteName(tblUsersRole r) { r.status = 1; db.Entry(r).State = EntityState.Modified; db.SaveChanges(); return(Json("Done")); }
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 async Task <IHttpActionResult> PuttblBranchShop(int id, tblBranchShop tblBranchShop) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != tblBranchShop.recNo) { return(BadRequest()); } db.Entry(tblBranchShop).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!tblBranchShopExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IHttpActionResult> PuttblBiddersInfo(string id) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var bidder = db.tblBiddersInfoes.SingleOrDefault(bid => bid.BiddersId == id); bidder.Status = 1; //verified db.Entry(bidder).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!tblBiddersInfoExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
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 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)); }
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()); }
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()); } }