Example #1
0
        public void PostCalibrationsTest()
        {
            // TODO: add unit test for the method 'PostCalibrations'
            CalibrationCreate body   = null; // TODO: replace null with proper value
            string            expand = null; // TODO: replace null with proper value
            var response             = instance.PostCalibrations(body, expand);

            Assert.IsInstanceOf <Calibration> (response, "response is Calibration");
        }
Example #2
0
 public void Init()
 {
     instance = new CalibrationCreate();
 }
        public async Task <IActionResult> UpdateCalibrations([FromHeader] string authToken, string stockId, CalibrationCreate cal)
        {
            if (!await _authenticationService.CheckAccess(authToken, "equipmentMgr"))
            {
                return(Unauthorized());
            }

            StockItem item = await _stockItemService.Get(stockId);

            if (item == null)
            {
                return(NotFound());
            }

            Equipment eq = await _equipmentService.GetFromStockId(stockId);

            Calibration calibration = Calibration.FromCreate(AuthenticationHelpers.GetUserIdFromToken(authToken), cal);

            _stockItemService.AddCalibration(eq.Id, item, calibration);

            await _logService.Create(new Log(
                                         null,
                                         AuthenticationHelpers.GetUserIdFromToken(authToken),
                                         DateTime.UtcNow,
                                         "StockItem modified.",
                                         "equipment",
                                         eq.Id,
                                         JsonSerializer.Serialize(_stockItemService.Get(stockId))
                                         ));

            return(Ok());
        }