public async Task Put()
        {
            //Arrange
            var get = await controller.Get(1);

            var okgetResult = Assert.IsType <OkObjectResult>(get);
            var entity      = Assert.IsType <op_control_identifier>(okgetResult.Value);


            var newEntity = new op_control_identifier();

            newEntity.identifier         = "ID1";
            newEntity.identifier_type    = "type1";
            newEntity.objective_point_id = 1;
            //should test the equals Equatable for all these too
            var huh = entity.Equals(newEntity);

            entity.identifier = "id4";
            //Act
            var response = await controller.Put(1, entity);

            // Assert
            var okResult = Assert.IsType <OkObjectResult>(response);
            var result   = Assert.IsType <op_control_identifier>(okResult.Value);

            Assert.Equal(entity.identifier, result.identifier);
        }
        public async Task Post()
        {
            //Arrange
            var entity = new op_control_identifier()
            {
                identifier = "id3", identifier_type = "type3", objective_point_id = 3
            };


            //Act
            var response = await controller.Post(entity);

            // Assert
            var okResult = Assert.IsType <OkObjectResult>(response);
            var result   = Assert.IsType <op_control_identifier>(okResult.Value);


            Assert.Equal("id3", result.identifier);
        }
 public async Task <IActionResult> Put(int id, [FromBody] op_control_identifier entity)
 {
     try
     {
         if (id < 0 || !isValid(entity))
         {
             return(new BadRequestResult());
         }
         var loggedInMember = LoggedInUser();
         if (loggedInMember == null)
         {
             return(new BadRequestObjectResult("Invalid input parameters"));
         }
         entity.last_updated    = DateTime.Now;
         entity.last_updated_by = loggedInMember.member_id;
         return(Ok(await agent.Update <op_control_identifier>(id, entity)));
     }
     catch (Exception ex)
     {
         return(await HandleExceptionAsync(ex));
     }
 }