Example #1
0
        public async Task <object> GetMaterial(InventoryIdInput input)
        {
            InventoryPoco inv;
            MaterialPoco  material;

            try
            {
                inv = await _context.Inventories.FindAsync(input.Id);

                material = await _context.Materials.FindAsync(inv.MaterialId);

                return(new
                {
                    inv.Id,
                    material.StockCode,
                    material.StockDescription,
                    input.Quantity,
                    input.BomNo,
                    exceeded = inv.Quantity < input.Quantity
                });
            }
            catch
            {
                inv = await _context.Inventories.FindAsync(input.Id);

                material = await _context.Materials.FindAsync(inv.MaterialId);

                return(new SimpleResult
                {
                    ErrorMessage = JsonConvert.SerializeObject(inv)
                });
            }
        }
Example #2
0
        public async Task <JsonResult> GetMaterial([FromBody] InventoryIdInput input)
        {
            var result = await _timesheet.GetMaterial(input);

            return(await GenerateResult(result, _userSettings));
        }