public async Task <IHttpActionResult> Put(string id, AU_DONVI instance) { var result = new TransferObj <AU_DONVI>(); if (id != instance.Id) { result.Status = false; result.Message = "Id không hợp lệ"; return(Ok(result)); } try { var item = _service.Update(instance); _service.UnitOfWork.Save(); result.Status = true; result.Data = item; result.Message = "Cập nhật thành công"; return(Ok(result)); } catch (Exception e) { result.Status = false; result.Message = e.Message; return(Ok(result)); } }
public List <IQueryFilter> GetFilters() { var result = new List <IQueryFilter>(); var refObj = new AU_DONVI(); if (!string.IsNullOrEmpty(this.MaDonVi)) { result.Add(new QueryFilterLinQ { Property = ClassHelper.GetProperty(() => refObj.MaDonVi), Value = this.MaDonVi, Method = FilterMethod.Like }); } if (!string.IsNullOrEmpty(this.MaDonViCha)) { result.Add(new QueryFilterLinQ { Property = ClassHelper.GetProperty(() => refObj.MaDonViCha), Value = this.MaDonViCha, Method = FilterMethod.Like }); } if (!string.IsNullOrEmpty(this.TenDonVi)) { result.Add(new QueryFilterLinQ { Property = ClassHelper.GetProperty(() => refObj.TenDonVi), Value = this.TenDonVi, Method = FilterMethod.Like }); } if (!string.IsNullOrEmpty(this.DiaChi)) { result.Add(new QueryFilterLinQ { Property = ClassHelper.GetProperty(() => refObj.DiaChi), Value = this.DiaChi, Method = FilterMethod.Like }); } if (!string.IsNullOrEmpty(this.Email)) { result.Add(new QueryFilterLinQ { Property = ClassHelper.GetProperty(() => refObj.Email), Value = this.Email, Method = FilterMethod.Like }); } if (!string.IsNullOrEmpty(this.MaCuaHang)) { result.Add(new QueryFilterLinQ { Property = ClassHelper.GetProperty(() => refObj.MaCuaHang), Value = this.MaCuaHang, Method = FilterMethod.Like }); } if (!string.IsNullOrEmpty(this.TenCuaHang)) { result.Add(new QueryFilterLinQ { Property = ClassHelper.GetProperty(() => refObj.TenCuaHang), Value = this.TenCuaHang, Method = FilterMethod.Like }); } return(result); }