What I am trying to do is create a dynamic way to unlock Records in that database after the time is up. A string is passed that is the types name.
I pass a string of the type to a JsonResult, this string contains the name of the class that I would like to create a Type from. I then want to create a GenericRepository from the Type that I just created.
I keep getting the error 'type1' is a variable but is used like a type. Is this a possible scenario?
public JsonResult UnlockRecord(string modelType)
{
Type type1 = Type.GetType(modelType);
GenericRepository<type1> typeRepository = new GenericRepository<type1>();
type1 lockedRecord = typeRepository.GetFirst();
typeRepository.BatchUnlock(type1.Id);
return Json(null);
}