public IHttpActionResult PuttblInsuranceClaim(int id, tblInsuranceClaim tblInsuranceClaim) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != tblInsuranceClaim.CliamId) { return(BadRequest()); } db.Entry(tblInsuranceClaim).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!tblInsuranceClaimExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public dynamic UpdatePassword(string email, string password) { List <tblFarmer> far = db.tblFarmers.ToList(); List <tblBidder> bid = db.tblBidders.ToList(); foreach (var item in far) { if (item.FarmerEmail == email) { item.FarmerPassword = password; byte[] encData_byte = new byte[item.FarmerPassword.Length]; encData_byte = System.Text.Encoding.UTF8.GetBytes(item.FarmerPassword); string encodedpassword = Convert.ToBase64String(encData_byte); item.FarmerPassword = encodedpassword; db.Entry(item).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return(Request.CreateResponse(HttpStatusCode.OK, "Valid")); } } foreach (var item in bid) { if (item.BidderEmail == email) { item.BidderPassword = password; db.Entry(item).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return(Request.CreateResponse(HttpStatusCode.OK, "Valid")); } } return(Request.CreateResponse(HttpStatusCode.NotFound, "NotFound")); }
public IHttpActionResult Post([FromUri] int Id, int bidderID, int latestbid) { tblBidding tblBidding = db.tblBiddings.Find(Id); tblBidding.BidderId = bidderID; tblBidding.PreviousBidPrice = tblBidding.CurrentBidPrice; tblBidding.CurrentBidPrice = latestbid; db.Entry(tblBidding).State = EntityState.Modified; db.SaveChanges(); return(Ok("OK")); }
public IHttpActionResult Post([FromUri] int Id, int adminId) { tblBidder bidder = db.tblBidders.Find(Id); bidder.BidderApproved = true; bidder.ApprovalAdminId = adminId; db.Entry(bidder).State = EntityState.Modified; db.SaveChanges(); return(Ok("OK")); }
public IHttpActionResult Post([FromUri] int Id, int adminId, int initprice) { tblCropRequest tblCropRequest = db.tblCropRequests.Find(Id); tblCropRequest.CropApproved = true; tblCropRequest.ApprovalAdminId = adminId; db.Entry(tblCropRequest).State = EntityState.Modified; db.SaveChanges(); tblBidding tblBidding = new tblBidding(); tblBidding.RequestId = tblCropRequest.RequestId; tblBidding.InitialPrice = initprice; tblBidding.CurrentBidPrice = initprice; tblBidding.PreviousBidPrice = initprice; DateTime dateTime = DateTime.Now; tblBidding.BidCloseTime = dateTime.AddMinutes(720); db.tblBiddings.Add(tblBidding); db.SaveChanges(); return(Ok("OK")); }