public JsonResult AjaxSendOffer(int reqid,string offerNote,double price,string offertype) { if (reqid == 0 || !PhotographersBml.IsAuthenticated()) return Json(false, JsonRequestBehavior.AllowGet); Photographers photographer = PhotographersBml.GetCurrentPhotographers(); MemberRequests req = MemberRequestBml.Find(reqid); Offers offer = new Offers(); offer.IsPaid = true; offer.RequestId = req.RequestId; offer.MemberId = req.MemberId; if (req.PhotographerId == null) offer.OfferType = "normal"; else offer.OfferType = "özel"; offer.Price = price; offer.Title = offerNote; offer.ShowGsm = true; offer.Status = 0; offer.PhotographerId = photographer.PhotographerId; bool result = OffersBml.Insert(offer); return Json(result, JsonRequestBehavior.AllowGet); }
public static bool Update(Offers offer) { try { db.Entry(offer).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return true; } catch (Exception ex) { return false; throw; } }
public static bool Insert(Offers offer) { try { Conversations con = new Conversations(); con.MemberId = offer.MemberId; con.OfferId = offer.OfferId; con.PhotographerId = offer.PhotographerId; con.RequestId = offer.RequestId; con.Status = 0; con.Title = offer.Title; offer.Conversations.Add(con); offer.Status = 0; offer.CreateTime = DateTime.Now; db.Offers.Add(offer); db.SaveChanges(); return true; } catch (Exception ex) { return false; throw; } }