Exemplo n.º 1
0
        public IActionResult Post([FromBody] LabData value)
        {
            var validationResult = value.Validate();

            if (!validationResult.IsValid) return BadRequest(validationResult.Errors);

            _memCache.Add(value);

            return Ok($"{value.ToString()} has been added");
        }
Exemplo n.º 2
0
        public IActionResult Put(Guid id, [FromBody] LabData value)
        {
            if (!_memCache.Has(id)) return NotFound("No such");

            var validationResult = value.Validate();

            if (!validationResult.IsValid) return BadRequest(validationResult.Errors);

            var previousValue = _memCache[id];
            _memCache[id] = value;

            return Ok($"{previousValue.ToString()} has been updated to {value.ToString()}");
        }
Exemplo n.º 3
0
        public IActionResult Post([FromBody] LabData value)
        {
            Log.Information("Acquiring team info");
            var validationResult = value.Validate();

            if (!validationResult.IsValid)
            {
                Log.Debug($"Uncorrected data");
                return(BadRequest(validationResult.Errors));
            }

            _memCache.Add(value);

            return(Ok($"{value.ToString()} has been added"));
        }
Exemplo n.º 4
0
        public IActionResult Put(Guid id, [FromBody] LabData value)
        {
            Log.Information("Acquiring team info");
            Log.Warning("User tried to delete information");
            if (!_memCache.Has(id))
            {
                return(NotFound("No such"));
            }

            var validationResult = value.Validate();

            if (!validationResult.IsValid)
            {
                return(BadRequest(validationResult.Errors));
            }

            var previousValue = _memCache[id];

            _memCache[id] = value;
            Log.Debug($"Attempt to put information");

            return(Ok($"{previousValue.ToString()} has been updated to {value.ToString()}"));
        }