Example #1
0
            public List <IQueryFilter> GetFilters()
            {
                var result = new List <IQueryFilter>();
                var refObj = new MdXuatXu();

                if (!string.IsNullOrEmpty(this.MaXuatXu))
                {
                    result.Add(new QueryFilterLinQ
                    {
                        Property = ClassHelper.GetProperty(() => refObj.MaXuatXu),
                        Value    = this.MaXuatXu,
                        Method   = FilterMethod.Like
                    });
                }
                if (!string.IsNullOrEmpty(this.TenXuatXu))
                {
                    result.Add(new QueryFilterLinQ
                    {
                        Property = ClassHelper.GetProperty(() => refObj.TenXuatXu),
                        Value    = this.TenXuatXu,
                        Method   = FilterMethod.Like
                    });
                }
                return(result);
            }
Example #2
0
        public async Task <IHttpActionResult> Delete(string id)
        {
            MdXuatXu instance = await _service.Repository.FindAsync(id);

            if (instance == null)
            {
                return(NotFound());
            }
            try
            {
                _service.Delete(instance.Id);
                await _service.UnitOfWork.SaveAsync();

                return(Ok(instance));
            }
            catch (Exception)
            {
                return(InternalServerError());
            }
        }