Ejemplo n.º 1
0
        public async Task <ApiResult <ServicesVm> > GetById(int IdSpend)
        {
            var spend = await _context.Spends.FindAsync(IdSpend);

            if (spend == null)
            {
                return(new ApiErrorResult <ServicesVm>("Không tìm thấy"));
            }
            var data = new ServicesVm()
            {
                Id          = spend.Id,
                Name        = spend.Name,
                Description = spend.Description,
                Img         = spend.Img,
                Status      = spend.Status
            };

            return(new ApiSuccessResult <ServicesVm>(data));
        }
        public async Task <ApiResult <ServicesVm> > GetById(int idMakeMoney)
        {
            var makeMoney = await _context.MakeMoneys.FindAsync(idMakeMoney);

            if (makeMoney == null)
            {
                return(new ApiErrorResult <ServicesVm>("Không tìm thấy"));
            }

            var data = new ServicesVm()
            {
                Id          = makeMoney.Id,
                Name        = makeMoney.Name,
                Description = makeMoney.Description,
                Img         = makeMoney.Img,
                Status      = makeMoney.Status
            };

            return(new ApiSuccessResult <ServicesVm>(data));
        }