public static bool Insert(PhotographerGenres pg) { using (FotografPaketiEntities db = new FotografPaketiEntities()) { try { if (IsExist((int)pg.PhotographerId, (int)pg.GenreId)) return false; pg.Status = false; db.PhotographerGenres.Add(pg); db.SaveChanges(); return true; } catch (Exception ex) { return false; throw; } } }
public static bool Update(PhotographerGenres pg) { using (FotografPaketiEntities db = new FotografPaketiEntities()) { try { db.Entry(pg).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return true; } catch (Exception ex) { return false; throw; } } }
public JsonResult AjaxInsertGenre(int pid,int genreid) { PhotographerGenres pg = new PhotographerGenres(); pg.PhotographerId = pid; pg.GenreId = genreid; bool result = PhotographerGenresBml.Insert(pg); return Json(result, JsonRequestBehavior.AllowGet); }