Example #1
0
        public async Task <GetIdPackMaterial> CreatePack(PackMaterialCreate bundle)
        {
            var result = await _materialApiClient.CreatePack(bundle);

            var data = new GetIdPackMaterial()
            {
                Name  = result.ResultObj.Name,
                Value = result.ResultObj.Value,
                Id    = result.ResultObj.Id
            };

            return(data);
        }
Example #2
0
        public async Task <ApiResult <GetIdPackMaterial> > CreatePack(PackMaterialCreate bundle)
        {
            var pack = new Pack()
            {
                Name        = bundle.Name,
                Value       = bundle.Value,
                Default     = false,
                IdMaterials = bundle.IdMaterial
            };

            _context.Packs.Add(pack);
            await _context.SaveChangesAsync();

            var result = new GetIdPackMaterial()
            {
                Name  = pack.Name,
                Value = pack.Value,
                Id    = pack.Id
            };

            return(new ApiSuccessResult <GetIdPackMaterial>(result));
        }