public int DeleteCustomModel(CustomsModel model) { using (Entities db = new Entities()) { map_customs entity = db.map_customs.FirstOrDefault(a => a.id == model.id); if (model != null) { db.map_customs.Remove(entity); } return(db.SaveChanges()); } }
public map_customs AddCustoms(CustomsModel model) { using (Entities db = new Entities()) { map_customs cmmodel = new map_customs(); cmmodel.x = model.x; cmmodel.y = model.y; cmmodel.userid = model.userid; cmmodel.remark = model.remark; cmmodel.createtime = DateTime.Now; db.map_customs.Add(cmmodel); db.SaveChanges(); return(cmmodel); } }