public JsonResult Create(LogisticsAreaCountryType obj) { try { NSession.SaveOrUpdate(obj); NSession.Flush(); } catch (Exception ee) { return Json(new { IsSuccess = false, ErrorMsg = "出错了" }); } return Json(new { IsSuccess = true }); }
public void AddAreaCountry(string id, int tid) { NSession.Delete("from LogisticsAreaCountryType where CountryCode=" + id + " and AreaCode in (select Id from LogisticsAreaType where LId =(select LId from LogisticsAreaType where Id=" + tid + "))"); NSession.Flush(); LogisticsAreaCountryType logcountry = new LogisticsAreaCountryType { CountryCode = id, AreaCode = tid }; NSession.Save(logcountry); }
public void DelAreaCountry(string id, int tid) { LogisticsAreaCountryType logc = new LogisticsAreaCountryType { CountryCode = id.ToString(), AreaCode = tid }; IList<LogisticsAreaCountryType> list = NSession.CreateCriteria(typeof(LogisticsAreaCountryType)) .Add(Example.Create(logc)) .List<LogisticsAreaCountryType>(); foreach (LogisticsAreaCountryType item in list) { NSession.Delete(item); NSession.Flush(); } }