コード例 #1
0
        public ActionResult GiveOffer(int projectId, FormCollection formCollection)
        {
            int    offerAmount      = Convert.ToInt32(formCollection["offerAmount"]);
            string offerDescription = formCollection["offerDescription"].ToString();

            Offer offer = new Offer
            {
                OfferPrice  = offerAmount,
                Description = offerDescription,
                ProjectId   = projectId,
                UserId      = Convert.ToInt32(Session["userID"])
            };

            _offerDal.CreateOffer(offer);

            TempData.Add("message", String.Format("{0} projesine {1} TL teklif verildi.", _projectDal.GetProject(projectId).Header, offerAmount));

            return(RedirectToAction("index", "Home"));
        }
コード例 #2
0
 public IHttpActionResult Post(Offer offer)
 {
     if (offer != null)
     {
         if (ModelState.IsValid)
         {
             Offer createdOffer = offerDal.CreateOffer(offer);
             return(CreatedAtRoute("DefaultApi", new { id = createdOffer.Id }, createdOffer));
         }
         else
         {
             return(BadRequest(ModelState));
         }
     }
     else
     {
         return(BadRequest("Offer can not be Null."));
     }
 }