public virtual void UpdateDiaDiem(DiaDiem _item) { if (_item == null) { throw new ArgumentNullException("DiaDiem"); } _item.TenKhongDau = CVCommon.convertToUnSign(_item.Ten); _diadiemRepository.Update(_item); }
public List <DiaDiem> DiaDiemSearch(string keyword = "", int top = 20) { var query = _diadiemRepository.Table; if (!String.IsNullOrWhiteSpace(keyword)) { var keywordkodau = CVCommon.convertToUnSign(keyword); query = query.Where(c => c.Ten.Contains(keyword) || c.TenKhongDau.Contains(keywordkodau)); } query = query.OrderBy(c => c.Id); return(query.Take(top).ToList()); }
public virtual PagedList <DiaDiem> GetAllDiaDiem(string tendiadiem = "", int pageIndex = 0, int pageSize = int.MaxValue) { var query = _diadiemRepository.Table; if (!String.IsNullOrWhiteSpace(tendiadiem)) { var tenkhongdau = CVCommon.convertToUnSign(tendiadiem); query = query.Where(c => c.Ten.Contains(tendiadiem) || c.TenKhongDau.Contains(tenkhongdau)); } query = query.OrderBy(c => c.Id); return(new PagedList <DiaDiem>(query, pageIndex, pageSize)); }
private void InsertOrUpdateDiaDiem(int nguonid, ENLoaiDiaDiem loai, string ten) { var item = GetDiaDiem(nguonid, loai); item.Ten = ten; item.TenKhongDau = CVCommon.convertToUnSign(ten); if (item.Id > 0) { _diadiemRepository.Update(item); } else { _diadiemRepository.Insert(item); } }