public static bool Update(PhotographerCities pc) { using (FotografPaketiEntities db = new FotografPaketiEntities()) { try { db.Entry(pc).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return true; } catch (Exception ex) { return false; throw; } } }
public static bool Insert(PhotographerCities pc) { using (FotografPaketiEntities db = new FotografPaketiEntities()) { try { if (IsExist((int)pc.PhotographerId, (int)pc.CityId)) return false; db.PhotographerCities.Add(pc); db.SaveChanges(); return true; } catch (Exception ex) { return false; throw; } } }
public JsonResult AjaxInsertCity(int pid,int cityId) { PhotographerCities pc = new PhotographerCities(); pc.PhotographerId = pid; pc.CityId = cityId; bool result = PhotographerCitiesBml.Insert(pc); return Json(result, JsonRequestBehavior.AllowGet); }