public static bool Insert(PhotographerCredits pc) { using (FotografPaketiEntities db = new FotografPaketiEntities()) { try { pc.AddTime = DateTime.Now; db.PhotographerCredits.Add(pc); db.SaveChanges(); return true; } catch (Exception ex) { return false; throw; } } }
public static bool Update(PhotographerCredits pc) { using (FotografPaketiEntities db = new FotografPaketiEntities()) { try { db.Entry(pc).State = EntityState.Modified; db.SaveChanges(); return true; } catch (Exception ex) { return false; throw; } } }
public JsonResult AjaxInsertCredit(int pid,int amount,string description) { PhotographerCredits pc = new PhotographerCredits(); pc.PhotographerId = pid; pc.Amount = amount; pc.Description = description; bool result = PhotographerCreditsBml.Insert(pc); return Json(result, JsonRequestBehavior.AllowGet); }