public async Task <ActionResult <MessageModel <string> > > DeleteIcProductStock(int IcProductStockId)
        {
            var res = new MessageModel <string>();

            if (!await _icProductStockServices.ExistEntityAsync(a => a.Id == IcProductStockId))
            {
                return(NotFound(StyleCode.NotFound(res)));
            }
            await _icProductStockServices.DeleteEntityByIdAsync(IcProductStockId);

            return(Ok(res));
        }
Пример #2
0
        public async Task <ActionResult <MessageModel <string> > > DeletePrProductCategory(int PrProductCategoryId)
        {
            var res = new MessageModel <string>();

            if (!await _prProductCategoryServices.ExistEntityAsync(a => a.Id == PrProductCategoryId))
            {
                return(NotFound(StyleCode.NotFound(res)));
            }
            await _prProductCategoryServices.DeleteEntityByIdAsync(PrProductCategoryId);

            return(Ok(res));
        }
Пример #3
0
        public async Task <ActionResult <MessageModel <string> > > DeleteRole(int id)
        {
            var res = new MessageModel <string>();

            if (!await _acRoleServices.ExistEntityAsync(a => a.Id == id))
            {
                return(NotFound(StyleCode.NotFound(res)));
            }
            await _acRoleServices.DeleteEntityByIdAsync(id);

            return(Ok(res));
        }
Пример #4
0
        public async Task <ActionResult <IEnumerable <IcWarehouseDto> > > GetIcWarehouseById(int id)
        {
            var res = new MessageModel <IcWarehouseDto>();

            if (!await _icWarehouseServices.ExistEntityAsync(a => a.Id == id))
            {
                return(NotFound(StyleCode.NotFound(res)));
            }
            var entity = await _icWarehouseServices.GetEntityByIdAsync(id);

            res.Data = _mapper.Map <IcWarehouseDto>(entity);
            return(Ok(res));
        }
Пример #5
0
        public async Task <ActionResult <IEnumerable <PrProductMaterialDto> > > GetPrProductMaterialById(int id)
        {
            var res = new MessageModel <PrProductMaterialDto>();

            if (!await _prProductMaterialServices.ExistEntityAsync(a => a.Id == id))
            {
                return(NotFound(StyleCode.NotFound(res)));
            }
            var entity = await _prProductMaterialServices.GetEntityByIdAsync(id);

            res.Data = _mapper.Map <PrProductMaterialDto>(entity);
            return(Ok(res));
        }
Пример #6
0
        public async Task <ActionResult <IEnumerable <AcRoleDto> > > GetRoleById(int id)
        {
            MessageModel <AcRoleDto> res = new MessageModel <AcRoleDto>();

            if (!await _acRoleServices.ExistEntityAsync(a => a.Id == id))
            {
                return(NotFound(StyleCode.NotFound(res)));
            }
            AcRole entity = await _acRoleServices.GetEntityByIdAsync(id);

            res.Data = _mapper.Map <AcRoleDto>(entity);
            return(Ok(res));
        }
Пример #7
0
        public async Task <ActionResult <MessageModel <PuSupplierDto> > > EditPuSupplier(PuSupplierEditDto puSupplierEditDto)
        {
            var res = new MessageModel <PuSupplierDto>();

            if (!await _pusupplierservices.ExistEntityAsync(a => a.Id == puSupplierEditDto.Id))
            {
                return(NotFound(StyleCode.NotFound(res)));
            }
            var entity = _mapper.Map <PuSupplier>(puSupplierEditDto);
            await _pusupplierservices.EditEntityAsync(entity);

            res.Data = _mapper.Map <PuSupplierDto>(entity);
            return(Ok(res));
        }
Пример #8
0
        public async Task <ActionResult <MessageModel <AcStaffDto> > > EditAcStaff(AcStaffEditDto acStaffEditDto)
        {
            MessageModel <AcStaffDto> res = new MessageModel <AcStaffDto>();

            if (!await _acStaffServices.ExistEntityAsync(a => a.Id == acStaffEditDto.Id))
            {
                return(NotFound(StyleCode.NotFound(res)));
            }
            AcStaff entity = _mapper.Map <AcStaff>(acStaffEditDto);
            await _acStaffServices.EditEntityAsync(entity);

            res.Data = _mapper.Map <AcStaffDto>(entity);
            return(Ok(res));
        }
Пример #9
0
        public async Task <ActionResult <MessageModel <string> > > DeleteCustomer(int id)
        {
            MessageModel <string> res = new MessageModel <string>();

            if (!await _slCustomerServices.ExistEntityAsync(a => a.Id == id))
            {
                return(NotFound(StyleCode.NotFound(res)));
            }

            await _slCustomerServices.DeleteEntityByIdAsync(id);

            res.Data = "成功";
            return(Ok(res));
        }
        public async Task <ActionResult <MessageModel <PrProductTaskDto> > > EditPrProductTask(PrProductTaskEditDto prProductTaskEditDto)
        {
            var res = new MessageModel <PrProductTaskDto>();

            if (!await _prProductTaskServices.ExistEntityAsync(a => a.Id == prProductTaskEditDto.Id))
            {
                return(NotFound(StyleCode.NotFound(res)));
            }
            PrProductTask entity = _mapper.Map <PrProductTask>(prProductTaskEditDto);
            await _prProductTaskServices.EditEntityAsync(entity);

            res.Data = _mapper.Map <PrProductTaskDto>(entity);
            return(Ok(res));
        }
Пример #11
0
        public async Task <ActionResult <MessageModel <AuRecordDto> > > EditAuRecord(AuRecordEditDto auRecordEditDto)
        {
            var res = new MessageModel <Model.Dtos.Dto.AuRecordDto>();

            if (!await _auRecordServices.ExistEntityAsync(a => a.Id == auRecordEditDto.Id))
            {
                return(NotFound(StyleCode.NotFound(res)));
            }
            var entity = _mapper.Map <AuRecord>(auRecordEditDto);
            await _auRecordServices.EditEntityAsync(entity);

            res.Data = _mapper.Map <AuRecordDto>(entity);
            return(Ok(res));
        }
Пример #12
0
        public async Task <ActionResult <MessageModel <AcRolePermissionDto> > > EditRolePermission(AcRolePermissionEditDto RolePermissionEditDto)
        {
            MessageModel <AcRolePermissionDto> res = new MessageModel <AcRolePermissionDto>();

            if (!await _acRolePermissionServices.ExistEntityAsync(a => a.Id == RolePermissionEditDto.Id))
            {
                return(NotFound(StyleCode.NotFound(res)));
            }
            AcRolePermission entity = _mapper.Map <AcRolePermission>(RolePermissionEditDto);
            await _acRolePermissionServices.EditEntityAsync(entity);

            res.Data = _mapper.Map <AcRolePermissionDto>(entity);
            return(Ok(res));
        }
        public async Task <ActionResult <MessageModel <IcProductStockDto> > > EditIcProductStock(IcProductStockEditDto icProductStockEditDto)
        {
            var res = new MessageModel <IcProductStockDto>();

            if (!await _icProductStockServices.ExistEntityAsync(a => a.Id == icProductStockEditDto.Id))
            {
                return(NotFound(StyleCode.NotFound(res)));
            }
            var entity = _mapper.Map <IcProductStock>(icProductStockEditDto);
            await _icProductStockServices.EditEntityAsync(entity);

            res.Data = _mapper.Map <IcProductStockDto>(entity);
            return(Ok(res));
        }
Пример #14
0
        public async Task <ActionResult <MessageModel <QmProductDto> > > EditAuRecord(QmProductEditDto qmProductEditDto)
        {
            var res = new MessageModel <QmProductDto>();

            if (!await _qmProductServices.ExistEntityAsync(a => a.Id == qmProductEditDto.Id))
            {
                return(NotFound(StyleCode.NotFound(res)));
            }
            var entity = _mapper.Map <QmProduct>(qmProductEditDto);
            await _qmProductServices.EditEntityAsync(entity);

            res.Data = _mapper.Map <QmProductDto>(entity);
            return(Ok(res));
        }
        public async Task <ActionResult <MessageModel <PrProductCategoryDto> > > EditUserInfo(AcUserInfoEditDto acUserInfoEditDto)
        {
            MessageModel <PrProductCategoryDto> res = new MessageModel <PrProductCategoryDto>();

            if (!await _prProductCategoryServices.ExistEntityAsync(a => a.Id == acUserInfoEditDto.Id))
            {
                return(NotFound(StyleCode.NotFound(res)));
            }
            PrProductCategory entity = _mapper.Map <PrProductCategory>(acUserInfoEditDto);
            await _prProductCategoryServices.EditEntityAsync(entity);

            res.Data = _mapper.Map <PrProductCategoryDto>(entity);
            return(Ok(res));
        }
Пример #16
0
        public async Task <ActionResult <MessageModel <IcCommodityStockDto> > > EditIcCommodityStock(IcCommodityStockEditDto puSupplierEditDto)
        {
            var res = new MessageModel <IcCommodityStockDto>();

            if (!await _Iccommoditystockservices.ExistEntityAsync(a => a.Id == puSupplierEditDto.Id))
            {
                return(NotFound(StyleCode.NotFound(res)));
            }
            var entity = _mapper.Map <IcCommodityStock>(puSupplierEditDto);
            await _Iccommoditystockservices.EditEntityAsync(entity);

            res.Data = _mapper.Map <IcCommodityStockDto>(entity);
            return(Ok(res));
        }
Пример #17
0
        public async Task <ActionResult <MessageModel <PrProductMaterialDto> > > EditIcProductRecordId(PrProductMaterialEditDto prProductMaterialEditDto)
        {
            var res = new MessageModel <PrProductMaterialDto>();

            if (!await _prProductMaterialServices.ExistEntityAsync(a => a.Id == prProductMaterialEditDto.Id))
            {
                return(NotFound(StyleCode.NotFound(res)));
            }
            var entity = _mapper.Map <PrProductMaterial>(prProductMaterialEditDto);
            await _prProductMaterialServices.EditEntityAsync(entity);

            res.Data = _mapper.Map <PrProductMaterialDto>(entity);
            return(Ok(res));
        }
Пример #18
0
        public async Task <ActionResult <MessageModel <AcRoleDto> > > EditUserInfo(AcRoleEditDto roleEditDto)
        {
            MessageModel <AcRoleDto> res = new MessageModel <AcRoleDto>();

            if (!await _acRoleServices.ExistEntityAsync(a => a.Id == roleEditDto.Id))
            {
                return(NotFound(StyleCode.NotFound(res)));
            }
            AcRole entity = _mapper.Map <AcRole>(roleEditDto);
            await _acRoleServices.EditEntityAsync(entity);

            res.Data = _mapper.Map <AcRoleDto>(entity);
            return(Ok(res));
        }
Пример #19
0
        public async Task <ActionResult <MessageModel <SlCustomerDto> > > EditCustomer(SlCustomerEditdDto slCustomerAddDto)
        {
            MessageModel <SlCustomerDto> res = new MessageModel <SlCustomerDto>();

            if (!await _slCustomerServices.ExistEntityAsync(a => a.Id == slCustomerAddDto.Id))
            {
                return(NotFound(StyleCode.NotFound(res)));
            }

            SlCustomer entity = _mapper.Map <SlCustomer>(slCustomerAddDto);
            await _slCustomerServices.EditEntityAsync(entity);

            res.Data = _mapper.Map <SlCustomerDto>(entity);
            return(Ok(res));
        }
Пример #20
0
        public async Task <ActionResult <MessageModel <PrProductCategoryDto> > > EditUserInfo(PrProductCategoryEditDto prProductCategoryEditDto)
        {
            MessageModel <PrProductCategoryDto> res = new MessageModel <PrProductCategoryDto>();

            if (!await _prProductCategoryServices.ExistEntityAsync(a => a.Id == prProductCategoryEditDto.Id))
            {
                return(NotFound(StyleCode.NotFound(res)));
            }
            if (string.IsNullOrEmpty(prProductCategoryEditDto.Name))
            {
                return(Ok(res.FailRequest(400, "请输入产品类型")));
            }
            PrProductCategory entity = _mapper.Map <PrProductCategory>(prProductCategoryEditDto);
            await _prProductCategoryServices.EditEntityAsync(entity);

            res.Data = _mapper.Map <PrProductCategoryDto>(entity);
            return(Ok(res));
        }
Пример #21
0
        public async Task <ActionResult <ActionResult <MessageModel <string> > > > Login(LoginDto loginDto)
        {
            MessageModel <string>   res        = new MessageModel <string>();
            JwtSecurityTokenHandler jwtHandler = new JwtSecurityTokenHandler();
            AcUserInfo user = await _acUserInfoServices.GetEntitys(a => a.Pwd == loginDto.Pwd && a.Account == loginDto.Account).FirstOrDefaultAsync();

            if (user == null)
            {
                return(NotFound(StyleCode.NotFound(res)));
            }
            string token = jwtHandler.WriteToken(new JwtSecurityToken
                                                     (issuer: _configuration["Authentication:Issuer"],
                                                     audience: _configuration["Authentication:Audience"],
                                                     claims: new Claim[]
            {
                new Claim("id", user.Id.ToString()),
            },
                                                     expires: DateTime.Now.AddDays(7),
                                                     signingCredentials: new SigningCredentials(new SymmetricSecurityKey(Encoding.ASCII.GetBytes(_configuration["Authentication:SigningKey"])), SecurityAlgorithms.HmacSha256)
                                                     ));

            res.Data = "Bearer " + token;
            return(Ok(res));
        }