コード例 #1
0
        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));
        }
コード例 #2
0
        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"));
        }
コード例 #3
0
        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"));
        }
コード例 #4
0
        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"));
        }
コード例 #5
0
        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"));
        }