예제 #1
0
        public async Task <ActionResult> UpdateProtocol(int id, ProtocolUpdateDto protocolUpdateDto)
        {
            var protocol = await _protocolRepository.GetProtocol(id);

            protocol.ProtocolName = protocolUpdateDto.ProtocolName;
            protocol.ModifiedAt   = protocolUpdateDto.ModifiedAt;

            _protocolRepository.Update(protocol);

            return(NoContent());
        }
예제 #2
0
        public async Task <CreateProtocolResponse> CreateOrUpdateProtocolAsync(Protocol protocol)
        {
            // TODO :: CHECK IF SUBTEST BELONGS TO TOKEN USER'S TESTS
            //https://stackoverflow.com/questions/46112258/how-do-i-get-current-user-in-net-core-web-api-from-jwt-token

            if (protocol.Id == 0)
            {
                _protocolRepository.Add(protocol);
            }
            else
            {
                _protocolRepository.Update(protocol);
            }
            await _unitOfWork.CompleteAsync();

            return(new CreateProtocolResponse(true, null, protocol));
        }
예제 #3
0
 public bool Update(Protocol model, int key) => protocolRepository.Update(model, key);
예제 #4
0
        public IActionResult UpdateProtocol([FromBody] Protocol model)
        {
            _repo.Update(model);

            return(new OkObjectResult(new { ProtocolId = model.ProtocolId }));
        }