Exemplo n.º 1
0
        public ActionResult addOffer(string oper, OfferSumGridModel addOffer, string vbPropertyId)
        {
            var context = new EFRepository();

            if (oper.Equals("add"))
            {
                EFOffer offer = new EFOffer();
                offer.Id         = 0;
                offer.PropertyId = Convert.ToInt32(vbPropertyId);
                offer.OfferDate  = Convert.ToDateTime(addOffer.OfferDate);
                offer.OfferAmt   = Convert.ToDecimal(addOffer.OfferAmt);
                offer.ExpireDate = Convert.ToDateTime(addOffer.ExpireDate);
                offer.Status     = addOffer.Status;
                context.EFOffers.Add(offer);
                context.SaveChanges();
            }
            return(Json(JSONResponseFactory.SuccessResponse()));
        }
Exemplo n.º 2
0
        // id is rowid and primary key of Offer record
        public ActionResult editOffer(string oper, OfferSumGridModel editOffer, string id)
        {
            var context = new EFRepository();

            if (oper.Equals("edit"))
            {
                EFOffer offer = new EFOffer();
                offer.Id         = Convert.ToInt32(editOffer.Id);
                offer.PropertyId = Convert.ToInt32(editOffer.PropertyId);
                offer.OfferDate  = Convert.ToDateTime(editOffer.OfferDate);
                offer.OfferAmt   = Convert.ToDecimal(editOffer.OfferAmt);
                offer.ExpireDate = Convert.ToDateTime(editOffer.ExpireDate);
                offer.Status     = editOffer.Status;
                context.EFOffers.Attach(offer);
                context.Entry(offer).State = EntityState.Modified;
                context.SaveChanges();
            }
            return(Json(JSONResponseFactory.SuccessResponse()));
        }